Jimmy Harden
Members
-
Joined
-
Last visited
Reputation Activity
-
Jimmy Harden got a reaction from BartB in Scheduling Windows UpdateAt the risk of stealing his thunder, I had Paul Csiki from Pulseway Support provide me the following PowerShell script a day or two ago in answer to this exact question. This should allow you to run the script at certain times using the automation features. I haven't yet tested it but on read through I like what I see.
As Paul says, I hope it helps.
Email contents copied below:
Hi Jimmy,
You can use this PowerShell script to install available Windows updates through the Pulseway automation feature:
Write-Host "Start Windows Update" $UpdateCollection = New-Object -ComObject Microsoft.Update.UpdateColl $Searcher = New-Object -ComObject Microsoft.Update.Searcher $Session = New-Object -ComObject Microsoft.Update.Session $Searcher = New-Object -ComObject Microsoft.Update.Searcher $results = $searcher.search("Type='software' AND IsInstalled = 0 AND IsHidden = 0 AND AutoSelectOnWebSites = 1") # Install Update if ($results.Updates.Count -eq 0) { Write-Host "No Update" # no updates. } else { # setup update collection foreach ($update in $results.Updates){ $UpdateCollection.Add($update) | out-null } # download update items Write-Host "Download update items" $Downloader = $Session.CreateUpdateDownloader() $Downloader.Updates = $UpdateCollection $Downloader.Download() # install update items Write-Host "Install update items" $Installer = New-Object -ComObject Microsoft.Update.Installer $Installer.Updates = $UpdateCollection $InstallationResult = $Installer.Install() # Check Result if ($InstallationResult.ResultCode -eq 2){ Write-Host "Update Success" } else { Write-Host "Some updates could not installed" } if ($InstallationResult.RebootRequired){ Write-Host "System needs to reboot." } Write-Host "Finish Windows Update." } I hope this helps.
Regards,
Paul Csiki
-
Jimmy Harden got a reaction from Martin_T in IT Glue Integration?Any plans to integrate Pulseway with IT Glue guys?