Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Managing windows updates (WUApilib)

Managing windows updates (WUApilib)

Scheduled Pinned Locked Moved C#
jsonquestion
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jacob D Dixon
    wrote on last edited by
    #1

    I'm working on a application that will manage Windows updates for you (asynchronous). Everything is working except it will popup messages to users. Like when installing Language Packs it will display the installation for that, and if trying to install Internet Explorer 9 it will popup and ask the user to Accept, Ask me Later, or Don't Install. Is there a way to hide everything and just install it? I've search through Microsoft's pages on this API and can't find it. Here is where I perform the install. I didn't include any of the code for the callbacks or downloads because it would a huge post which you all probably wouldn't like lol. If you want me to I can.

    public static void Install(UpdateCollection installs)
    {
    if (installer != null || installs.Count > 0)
    {
    if (updateSession == null)
    updateSession = new UpdateSessionClass();

                try
                {
                    installer = updateSession.CreateUpdateInstaller();
                    installer.Updates = installs;
                    installer.AllowSourcePrompts = false;
                    installer.parentWindow = null;
    
                    WUInstProgress installProgress = new WUInstProgress();
                    WUInstCompleted installCompleted = new WUInstCompleted();
    
                    installCompleted.InstCompleted += new InstCompletedDelegate(installCompleted\_InstCompleted);
                    installer.BeginInstall(installProgress, installCompleted, null);
                }
                catch (Exception ex)
                {
                    ReportError(ex.ToString());
                }
            }
            else
                ReportLog("Install collection was null or empty");
        }
    
    N D J 3 Replies Last reply
    0
    • J Jacob D Dixon

      I'm working on a application that will manage Windows updates for you (asynchronous). Everything is working except it will popup messages to users. Like when installing Language Packs it will display the installation for that, and if trying to install Internet Explorer 9 it will popup and ask the user to Accept, Ask me Later, or Don't Install. Is there a way to hide everything and just install it? I've search through Microsoft's pages on this API and can't find it. Here is where I perform the install. I didn't include any of the code for the callbacks or downloads because it would a huge post which you all probably wouldn't like lol. If you want me to I can.

      public static void Install(UpdateCollection installs)
      {
      if (installer != null || installs.Count > 0)
      {
      if (updateSession == null)
      updateSession = new UpdateSessionClass();

                  try
                  {
                      installer = updateSession.CreateUpdateInstaller();
                      installer.Updates = installs;
                      installer.AllowSourcePrompts = false;
                      installer.parentWindow = null;
      
                      WUInstProgress installProgress = new WUInstProgress();
                      WUInstCompleted installCompleted = new WUInstCompleted();
      
                      installCompleted.InstCompleted += new InstCompletedDelegate(installCompleted\_InstCompleted);
                      installer.BeginInstall(installProgress, installCompleted, null);
                  }
                  catch (Exception ex)
                  {
                      ReportError(ex.ToString());
                  }
              }
              else
                  ReportLog("Install collection was null or empty");
          }
      
      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      I don't believe you can control these prompts since they are coming from the component being installed, which you have access to.


      I know the language. I've read a book. - _Madmatt

      1 Reply Last reply
      0
      • J Jacob D Dixon

        I'm working on a application that will manage Windows updates for you (asynchronous). Everything is working except it will popup messages to users. Like when installing Language Packs it will display the installation for that, and if trying to install Internet Explorer 9 it will popup and ask the user to Accept, Ask me Later, or Don't Install. Is there a way to hide everything and just install it? I've search through Microsoft's pages on this API and can't find it. Here is where I perform the install. I didn't include any of the code for the callbacks or downloads because it would a huge post which you all probably wouldn't like lol. If you want me to I can.

        public static void Install(UpdateCollection installs)
        {
        if (installer != null || installs.Count > 0)
        {
        if (updateSession == null)
        updateSession = new UpdateSessionClass();

                    try
                    {
                        installer = updateSession.CreateUpdateInstaller();
                        installer.Updates = installs;
                        installer.AllowSourcePrompts = false;
                        installer.parentWindow = null;
        
                        WUInstProgress installProgress = new WUInstProgress();
                        WUInstCompleted installCompleted = new WUInstCompleted();
        
                        installCompleted.InstCompleted += new InstCompletedDelegate(installCompleted\_InstCompleted);
                        installer.BeginInstall(installProgress, installCompleted, null);
                    }
                    catch (Exception ex)
                    {
                        ReportError(ex.ToString());
                    }
                }
                else
                    ReportLog("Install collection was null or empty");
            }
        
        D Offline
        D Offline
        Dan Mos
        wrote on last edited by
        #3

        While I can't help you directly, you can bingle SilentInstall for those apps/components if any such options. Another possible way would be robocopy or the likes. Good Luck. For instance take a look here or herefor a silent or unattended install of .net framework 4. They(MS) say it's like this: dotnetfx.exe /q:a /c:"install /q" Or just search for it yourself. My bingle foo is pretty low. :)

        All the best, Dan

        modified on Wednesday, July 13, 2011 12:57 PM

        J 1 Reply Last reply
        0
        • D Dan Mos

          While I can't help you directly, you can bingle SilentInstall for those apps/components if any such options. Another possible way would be robocopy or the likes. Good Luck. For instance take a look here or herefor a silent or unattended install of .net framework 4. They(MS) say it's like this: dotnetfx.exe /q:a /c:"install /q" Or just search for it yourself. My bingle foo is pretty low. :)

          All the best, Dan

          modified on Wednesday, July 13, 2011 12:57 PM

          J Offline
          J Offline
          Jacob D Dixon
          wrote on last edited by
          #4

          But that isn't using the windows update API. The problem is I'm not exactly sure how or if it is possible to tell using the API which updates require a users input. If it does require a user input I could set it as needed to be manually installed and skip it or fire off another script to manually download the files and run it silently.

          1 Reply Last reply
          0
          • J Jacob D Dixon

            I'm working on a application that will manage Windows updates for you (asynchronous). Everything is working except it will popup messages to users. Like when installing Language Packs it will display the installation for that, and if trying to install Internet Explorer 9 it will popup and ask the user to Accept, Ask me Later, or Don't Install. Is there a way to hide everything and just install it? I've search through Microsoft's pages on this API and can't find it. Here is where I perform the install. I didn't include any of the code for the callbacks or downloads because it would a huge post which you all probably wouldn't like lol. If you want me to I can.

            public static void Install(UpdateCollection installs)
            {
            if (installer != null || installs.Count > 0)
            {
            if (updateSession == null)
            updateSession = new UpdateSessionClass();

                        try
                        {
                            installer = updateSession.CreateUpdateInstaller();
                            installer.Updates = installs;
                            installer.AllowSourcePrompts = false;
                            installer.parentWindow = null;
            
                            WUInstProgress installProgress = new WUInstProgress();
                            WUInstCompleted installCompleted = new WUInstCompleted();
            
                            installCompleted.InstCompleted += new InstCompletedDelegate(installCompleted\_InstCompleted);
                            installer.BeginInstall(installProgress, installCompleted, null);
                        }
                        catch (Exception ex)
                        {
                            ReportError(ex.ToString());
                        }
                    }
                    else
                        ReportLog("Install collection was null or empty");
                }
            
            J Offline
            J Offline
            Jacob D Dixon
            wrote on last edited by
            #5

            Ahhh I over looked it: http://msdn.microsoft.com/en-us/library/aa386492(v=VS.85).aspx[^] Using IUpdateInstaller2 instead of IUpdateInstaller allows you to forcequiet installs. It doesn't hurt to go through all the references again a few times :-). I will post back if it worked or not.... *Update* Worked pretty good! The only thing is the updates will still fail if it is unable to install silently. The one I tested was Internet Explorer 9. At least this gives me the ability to filter them out and not have it pending for a users input.

            modified on Wednesday, July 13, 2011 10:20 PM

            D 1 Reply Last reply
            0
            • J Jacob D Dixon

              Ahhh I over looked it: http://msdn.microsoft.com/en-us/library/aa386492(v=VS.85).aspx[^] Using IUpdateInstaller2 instead of IUpdateInstaller allows you to forcequiet installs. It doesn't hurt to go through all the references again a few times :-). I will post back if it worked or not.... *Update* Worked pretty good! The only thing is the updates will still fail if it is unable to install silently. The one I tested was Internet Explorer 9. At least this gives me the ability to filter them out and not have it pending for a users input.

              modified on Wednesday, July 13, 2011 10:20 PM

              D Offline
              D Offline
              Dan Mos
              wrote on last edited by
              #6

              cool find.:thumbsup:

              All the best, Dan

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups