Hey all,
I’m trying to figure out how to run a script that goes out and only downloads all available windows updates. This makes patching from Windows Update go much quicker as you only have to install and reboot. Right now all of this is handled manually. We are looking at automating our patching procedures, but that is a topic for another time. Here is the script I have so far:
$Servers = get-content “c:\temp\servers.txt”
foreach($Server in $Servers)
{
$computer = $env:computername
$body = Get-WUInstall -DownloadOnly -AcceptAll -UpdateType Software -Verbose | out-string;
$recipients = “<david.solnok@mycompany.com>”
write-host ($body)
$email = @{
From = “WindowsUpdates@mycompany.com”
To = $recipients
Subject = “Downloaded Updates on $computer”
SMTPServer = “insert IP address”
Body = $body
}
send-mailmessage @email
}
Right now it appears that it is only running the script on the server that I’m logged into via RDP. I also tried this script using the invoke-command commandlet but couldn’t get that to work either.
Any assistance is greatly appreciated, thanks!