Home > Batch Scripting, PowerShell Scripting, Scripting, Wsus/Updates. > take this patch wednesday!

take this patch wednesday!

Recently in one of my more deflating patch wednesday evenings (aka the lonliest it night of the month). i realised that a script i had received a while back could be implemented to do all this for me…

I have 30+ servers in the dublin office alone, and all need to be patched once a month (thank you Mr Gates). Now if you work that out thats the equivalent of 7 minutes (download, install and reboot) per server * 30 servers = a very bored Andrew.

Step in psexec! using a remote script i now can patch all servers over vpn, without logging into a session or even paying much attention!attached to this post is a script provided by microsoft that will force a pc to download and install all updates available to it! SWEET!

now do two things:

create a text file, with all server names i.e.

server1
server2
server3

name it servers.txt, and save it to the system. next download the attached script and place it on a network share.

And heres the science bit:

psexec @c:\computers.txt -u domain\username -p password -i cmd.exe /c \\server\share\wsus.vbs

once its finished patching, it will move onto the next server and so on!

once its finished all the servers, you need to stop the windows update service (if its a terminal server, it will stop the users seeing “your computer has recently been updated etc”) or just restart them. using another psexec script, or good old fashioned:

shutdown -m \\computername -f -r -t 10 -c “update restart”
hope this helps 😉

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: