Quicktips: is a reboot required after Windows updates installation

I’ve came across a nice tips when looking for something about the Windows Update Agent (WUA) API.

Let’s say you’ve performed updates installation but forgot to track the global result of the installation process.

There’s actually a way to query it afterward 😀

(New-Object -ComObject "Microsoft.Update.SystemInfo").
RebootRequired

You can have it as a simple function as well:

Function Test-WUARebootRequired {
    try {
        (New-Object -ComObject "Microsoft.Update.SystemInfo").RebootRequired
    } catch {
        Write-Warning -Message "Failed to query COM object because $($_.Exception.Message)"
    }
}
Test-WUARebootRequired
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s