Jump to content

Scheduling Windows Update


Recommended Posts

13 minutes ago, Paul said:

Hi,

Scheduling windows updates isn't supported as of now however this will be possible in the upcoming patch management module (should come in Q1-Q2 2017).

-Paul

Would this be possible to run as a scheduled task using a Powershell Script?

Link to post
Share on other sites

At 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

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...