2

Using the Windows Update Agent API, one can list Windows updates. E.g.:

Set UpdateSession = CreateObject("Microsoft.Update.Session")
Set UpdateSearcher = UpdateSession.CreateUpdateSearcher()
Set SearchResult = UpdateSearcher.Search("IsInstalled=0 OR IsInstalled=1")
Set Updates = SearchResult.Updates
For I = 0 to SearchResult.Updates.Count-1
    Set update = searchResult.Updates.Item(I)
    WScript.Echo I + 1 & "> " & update.Title
Next

Since above I am querying for both installed and non-installed updates, I assume the result lists all available updates for my current Windows edition/build. Is that correct?

My point now is: can I query for a different edition too?
For example listing Windows Server 2016 updates from a Windows 10 system.

The idea is to easily provision a developer Windows virtual machine, taking the ISO and the most recent cumulative update.

antonio
  • 10,629
  • 13
  • 68
  • 136

1 Answers1

1

To resurrect a dead question!

No, the Windows Update client is entirely predicated on the current machine. I've inspected the web traffic in a bid to reverse-engineer the update server traffic, but I got nowhere. YMMV.

The typical approach would be to have a build server create an image from the base ISO, start it up, apply updates, then shut it back down and create a master image from it. You would do this on a regular basis, so that whenever a new VM is provisioned it is no more than x days behind on updates. E.g. you could do it nightly.

Check out a tool called Packer. (This is not an endorsement, just an example.)

If you go down this road, you also open doors for yourself to do things such as run security scans against the image or install convenience packages. The more you can push into an image, the fewer tasks you have in your daily workload.

You mentioned that this is for developer machines. Have you considered dev containers in VS Code?

FSCKur
  • 920
  • 7
  • 16
  • Thank you. Currently I am using mostly Linux, so I assume I cannot use a Windows container with Linux VS Code. As for Packer, if I understand correctly I can build an updated VM with a Packer script, starting from a base ISO. _Can you point me to any (GitHub) Packer script working from Linux?_ – antonio Nov 21 '20 at 20:43
  • About Code, I think it doesn't matter. I use Windows on the desktop but do my Linux dev in a Linux container. After initial setup, I have not had any xplat issues. I don't think I can point you at any example packer scripts - I moved out of ops a while back and don't have experience myself with it. I believe it's a pattern that people find appropriate, and I do know that at least some people find it a good tool and fit for purpose (and talk about it extensively!) – FSCKur Nov 23 '20 at 16:46