From ad4eb751a544f5d44d1171512a556c3626ef5a54 Mon Sep 17 00:00:00 2001 From: Trond Hindenes Date: Mon, 6 Jun 2016 23:18:51 +0200 Subject: [PATCH] moved pending reboot to powershell.ps1 --- lib/ansible/module_utils/powershell.ps1 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/ansible/module_utils/powershell.ps1 b/lib/ansible/module_utils/powershell.ps1 index 757279aba6..17b692f215 100644 --- a/lib/ansible/module_utils/powershell.ps1 +++ b/lib/ansible/module_utils/powershell.ps1 @@ -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 + } + +} \ No newline at end of file