Poool777
Poool777

Reputation: 31

Silent install of .msu windows updates?

I am encountering small problem with windows updates silent install. Why I need it? I have bit copy of system disk which I am using for reinstall win7(with advantage of .net framework, visual studio, java and 50+ another apps installed in once). Then I need install some important update. I coded small utillity in c#, working OK except install is not silent even using startInfo.Arguments = "/quiet/norestart/passive";. Not silent : I mean there are at least two windows like asking if I need install or reboot options in end.

Problem is spoken in another forum How are people deploying HOTFIXES .msu files? but solution is a bit not clear for me. Does somebody know any way how fix it? Again, startInfo.Arguments = "/quiet/norestart/passive"; or startInfo.Arguments = @"/qb!"+ "REBOOT=ReallySuppress"+ @"/qn"; are not working and in link is explained why. textBox1.Text is location af all hotfixes and updates in one directory.

{

        string[] filePaths = Directory.GetFiles(textBox1.Text);
        ProcessStartInfo startInfo = new ProcessStartInfo();
        startInfo.CreateNoWindow = true;
        startInfo.UseShellExecute = true;
        startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
        //startInfo.Arguments = "/quiet/norestart/passive";

        for (int i = 0; i < filePaths.Length; i++)
        {
            label1.Text = "Working";
            startInfo.FileName = filePaths[i];
            startInfo.Arguments = @"/qb!"+ "REBOOT=ReallySuppress"+ @"/qn";

            try
            {
                Process.Start(startInfo.FileName).WaitForExit(); 

            }
               catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

        }
        label1.Text = " Done ";

        }

Upvotes: 2

Views: 2562

Answers (2)

Poool777
Poool777

Reputation: 31

Finally I bypassed it using pure CMD line. Silent install without windows except exceptions.

private void button1_Click(object sender, EventArgs e)
    {
        string[] filePaths = Directory.GetFiles(textBox1.Text);
        Process process = new Process();
        process.StartInfo.FileName = "cmd.exe";
        process.StartInfo.CreateNoWindow = true;
        process.StartInfo.UseShellExecute = false;
        process.EnableRaisingEvents = false;

        for (int i = 0; i < filePaths.Length; i++)
        {
            if (i == 0) { label1.Text = "Working On first task"; }
            process.StartInfo.Arguments = "/C " + "@" + "\"" + filePaths[i] + "\"" + " /quiet /norestart";
            process.Start();
            process.WaitForExit();
            label1.Text = (100 * i / filePaths.Length).ToString() + " % is done"; 

        }
        label1.Text = "Done";

    }

Upvotes: 0

Joey
Joey

Reputation: 354724

For a start you're just chaining together the arguments without spaces and thus are only passing a single argument that likely won't work. Try

startInfo.Arguments = "/qb! REBOOT=ReallySuppress /qn"

Upvotes: 1

Related Questions