locked
Pending Updates RRS feed

  • Question

  • Hi,

    Is there a way to check pending computer restart after installing updates on it?  I would like to avoid opening control panel and manually checking if there is a pending reboot on the computer. 

    Monday, September 25, 2017 6:22 AM

Answers

  • Hi,

    This may help as well. It will give you yellow if the answer is yes and green if no +nr of installed updates

    If ( Test-path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" ) 
    { 
    Write-Host -fore Yellow "System Reboot Pending: Yes" 
    Write-Host "Number of Installed Updates: $((get-hotfix).count)"
    Write-Host "Pending since: $((Get-ItemProperty -path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" -Name RebootRequiredSince).RebootRequiredSince)"
    } 
    
    else { 
    Write-host -fore Green "System Reboot Pending: No"  
    Write-Host "Number of Installed Updates: $((get-hotfix).count)"
    }


    Please remember to mark the replies as answers if they help.,

    NEDIMMEHIC.ORG

    • Marked as answer by FLAN4 Monday, September 25, 2017 7:08 AM
    Monday, September 25, 2017 6:34 AM

All replies