Merge pull request #2138 from UrBnW/winboot
fix(windows) local rebootpending
This commit is contained in:
commit
8974e32891
|
@ -47,16 +47,12 @@ Try {
|
||||||
## Setting CBSRebootPend to null since not all versions of Windows has this value
|
## Setting CBSRebootPend to null since not all versions of Windows has this value
|
||||||
$CBSRebootPend = $null
|
$CBSRebootPend = $null
|
||||||
|
|
||||||
## Querying WMI for build version
|
|
||||||
$WMI_OS = Get-WmiObject -Class Win32_OperatingSystem -Property BuildNumber, CSName -ComputerName $ComputerName -ErrorAction Stop
|
|
||||||
|
|
||||||
## Making registry connection to the local/remote computer
|
## Making registry connection to the local/remote computer
|
||||||
$HKLM = [UInt32] "0x80000002"
|
$HKLM = [UInt32] "0x80000002"
|
||||||
$WMI_Reg = [WMIClass] "\\\\$ComputerName\\root\\default:StdRegProv"
|
$WMI_Reg = [WMIClass] "\\\\$ComputerName\\root\\default:StdRegProv"
|
||||||
|
|
||||||
## If Vista/2008 & Above query the CBS Reg Key
|
$RegSubKeysCBS = $WMI_Reg.EnumKey($HKLM,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Component Based Servicing\\")
|
||||||
If ([Int32]$WMI_OS.BuildNumber -ge 6001) {
|
If ($RegSubKeysCBS.ReturnValue -eq 0) {
|
||||||
$RegSubKeysCBS = $WMI_Reg.EnumKey($HKLM,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Component Based Servicing\\")
|
|
||||||
$CBSRebootPend = $RegSubKeysCBS.sNames -contains "RebootPending"
|
$CBSRebootPend = $RegSubKeysCBS.sNames -contains "RebootPending"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue