Skip to content

Commit

Permalink
Improved Get-PendingRebootStatus
Browse files Browse the repository at this point in the history
  • Loading branch information
trondhindenes authored and nitzmahone committed Nov 11, 2016
1 parent de13f91 commit 8874c1d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/ansible/module_utils/powershell.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ Function Get-PendingRebootStatus
#Function returns true if computer has a pending reboot
$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
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
}
Expand Down

0 comments on commit 8874c1d

Please sign in to comment.