VDI Windows Update Script

When configuring Windows for use in VDI, we disable Windows Update.  Why push updates to 1,000 end points when you can instead update the master (be it a Linked Clone parent or an Operating System layer) and just switch everyone else over to the updated version?  Of course, your admins will still need to be able to update their master image, which isn't allowed if the Windows Update service is disabled.

I know that it's easy enough to go in, enable and start the service, apply updates and then disable the service once again... but if something's that easy to do and must be done over and over, it's probably worth scripting.  In fact, referencing the XKCD "Is It Worth The Time" chart (I'm so happy that I have an excuse to link to XKCD on here), since this is a monthly task and I'm probably shaving about 30 seconds off of the process, I can see that my 10 minutes spent looking up the commands to do this was time well spent!

Anyway, the script is super basic; I just threw a shortcut to it onto the administrator's desktop, in order to make it nice and easy to access.  All that it does is set the Windows Update service to manual, start the service, then open the Windows Update application so that an administrator may select the updates that they desire.  When the administrator is done applying updates, they may "press any key" in the window to continue the script and disable the Windows Update service again.  As with all scripts here, this is for educational purposes, use at your own risk, etc. your mileage may vary.

@echo off
powershell set-service "wuauserv" -startuptype "manual"
powershell start-service "wuauserv"
wuapp
echo Apply desired updates, then continue (or restart, as needed) the script to disable Windows Update again.
Pause
powershell stop-service "wuauserv"
powershell set-service "wuauserv" -startuptype "disabled"

Comments

  1. Really nice, I have been doing this manually and this is great help! Thanks!! Love the blog!

    ReplyDelete

Post a Comment

Sorry guys, I've been getting a lot of spam recently, so I've had to turn on comment moderation. I'll do my best to moderate them swiftly after they're submitted,

Popular posts from this blog

PowerShell Sorting by Multiple Columns

Clone a Standard vSwitch from one ESXi Host to Another

Deleting Orphaned (AKA Zombie) VMDK Files