Skip to content

Commit

Permalink
Merge pull request ansible#16161 from trondhindenes/win_pending_reboo…
Browse files Browse the repository at this point in the history
…t_in_powershell

moved pending reboot to powershell.ps1
  • Loading branch information
nitzmahone committed Jun 6, 2016
2 parents e36b401 + ad4eb75 commit a9aab76
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/ansible/module_utils/powershell.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,20 @@ Function Get-FileChecksum($path)
}
return $hash
}

Function Get-PendingRebootStatus
{
# Check if reboot is required, if so notify CA. The MSFT_ServerManagerTasks provider is missing on client SKUs
#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)
{
return $True
}
else
{
return $False
}

}

0 comments on commit a9aab76

Please sign in to comment.