I'm having problems helping a client with their PC. I'm trying to install all available important updates using TeamViewer, but I have to continuously restart before it will check for more updates. Then, I have to call them back and ask to reconnect to TeamViewer. I'm trying to be able to do this process unattended. I think the best way to do so is with a Visual Basic script. How can I instruct the computer to check for updates, install all important updates, restart, and check again, until all important updates are installed? The script needs to be able to run on startup and delete itself after completion. I'm not sure how to do this.

  • 1
    I recently did something similar using C# for my company (since it's theirs, I can't give out source). But there is an API to do this: WUApi.dll. Here is an example of use. – nerdwaller May 11 '14 at 12:54
  • This is perfect, I already develop in C#. – Phoenix Logan May 11 '14 at 12:56
  • I'll migrate that to an answer :) – nerdwaller May 11 '14 at 12:57
  • 1
    Might be of interest: Searching, Downloading, and Installing Updates – and31415 May 11 '14 at 13:04

Recently, I did something very similar for my work (maintaining a fleet of Virtual Machines). I can't give out the direct source for it, since they own it. But the API for windows to do this is WUApi.dll (iirc it's in %SystemRoot%\WUApi.dll).

For a usage example, see this stack overflow post.

You may also want the Microsoft Reference Page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.