mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 22:33:25 +00:00
Improved Get-PendingRebootStatus
This commit is contained in:
committed by
Matt Davis
parent
de13f91a50
commit
8874c1dc39
@@ -236,7 +236,8 @@ Function Get-PendingRebootStatus
|
|||||||
#Function returns true if computer has a pending reboot
|
#Function returns true if computer has a pending reboot
|
||||||
$featureData = invoke-wmimethod -EA Ignore -Name GetServerFeature -namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
|
$featureData = invoke-wmimethod -EA Ignore -Name GetServerFeature -namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
|
||||||
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
|
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
|
||||||
if(($featureData -and $featureData.RequiresReboot) -or $regData)
|
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| where {$_.PSChildName -eq "RebootPending"}
|
||||||
|
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
|
||||||
{
|
{
|
||||||
return $True
|
return $True
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user