Requires SCCM Client (WMI class CCM_ClientUtilities must exist)
Function IsRebootPending{
<#
.SYNOPSIS
Check if the pending reboot exists. Returns $true or $false.
.PARAMETER Computer
Computer to detect if a pending reboot exists, default is local machine.
.EXAMPLE
IsRebootPending -Computer "PC0001"
#>
param(
[Parameter(Mandatory=$false,Position=1, HelpMessage="Computer to run detection against")]
[ValidateNotNullOrEmpty()]
[String[]]
$ComputerName = $env:COMPUTERNAME
)
$reboot = [wmiclass]"\\$ComputerName\root\ccm\ClientSDK:CCM_ClientUtilities"
$result = $reboot.DetermineIfRebootPending() | Select RebootPending
$result.RebootPending
}