The code below tests whether a reboot is pending:
$rebootRequired = Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending" "Pending reboot: $rebootRequired"
The code below tests whether a reboot is pending:
$rebootRequired = Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending" "Pending reboot: $rebootRequired"