Overcoming the Remote Windows Update Problem

by i255d at 2013-03-12 10:32:54

As many of you know, this doesn’t work:

$session = New-PSSession -ComputerName BIGSERVER
Invoke-Command -ScriptBlock { Import-Module PSWindowsUpdate } -Session $session
Invoke-Command -ScriptBlock { Get-Command } -Session $session
Invoke-Command -ScriptBlock { Get-WUInstall -AcceptAll -AutoReboot -IgnoreUserInput } -Session $session

We have worked out a script using Pearl and PsExec that does work, but I want to come up with as close to a all PowerShell solution as possible. (If you would like to submit your Psexec solution, that would be great)

I have read that creating a scheduled task and envoking it remotely is one possiblitly. Can this be done remotely? Does this require a script on the local box? Will this work on 2003 to 2008r2?

Let the festivities begin. I am on a huge patching projet that I want to shorten I am in this until we get a solid end to end solution for patching server from 2003 to 2008 R2.
by DonJ at 2013-03-13 08:08:24
On older than Win2012, you could remotely invoke the AT or Schtask.exe command to create a scheduled task. You wouldn’t need a script on the remote machine.
by i255d at 2013-03-14 06:06:51
So, are you saying the best way to trigger the Windows updating process is to use scheduled tasks? Is this done the same on 2003 as 2008 as 2008r2? Do you have an example of how to start?
by DonJ at 2013-03-14 07:54:03
Well, no, I didn’t say "best" way. I’d say "a" way. When you start wanting compatibility back to 2003, you have to rely on command-line utilities more than PowerShell. Run AT or SchTasks.exe and you should see their command-line syntax. Or, the docs are at http://technet.microsoft.com/en-us/libr … 10%29.aspx.
by i255d at 2013-03-14 08:27:36
I have loaded on PowerShell on all my 2003 boxes. I don’t want that to be the focus, most of those 2003 boxes will be gone by the end of the year. So, what do you think is the best way, or are the top couple of ways, to script out my window updating on 2008 servers and higher?
by DonJ at 2013-03-14 08:33:17
Probably still Schtasks.exe. Until Win8 and Win2012, you don’t get PowerShell access to scheduled tasks - and I do think that’s a good way to trigger what you need to trigger. ANY machine with PowerShell v3 can create a different type of scheduled task - look at the PSScheduledJob module - which would also be an option. I believe there’s also a COM object you can instantiate - that should work on any version, and is documented at http://msdn.microsoft.com/en-us/library … 85%29.aspx. That doc page has information on using WUA from a remote computer, which might be helpful. If you narrow down which approach you want to take we can probably help you figure out what, specifically, to do.