Last active
April 2, 2019 09:21
-
-
Save danjpadgett/1da2596ae3e3dc407731a4941ced8872 to your computer and use it in GitHub Desktop.
prompt for a/c power during in place upgrade.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##//Call this at the start of the TS. serviceui.exe -process:TsProgressUI.exe %windir%\System32\WindowsPowerShell\v1.0\powershell.exe -WindowStyle hidden -executionpolicy Bypass -file .\PowerCheck.ps1 | |
##//DEMO - https://imgur.com/a/44TfdxX | |
if (Get-WmiObject -Query "Select BatteryStatus from Win32_Battery WHERE BatteryStatus=2") {break} | |
else { | |
$T1 = New-Object -ComObject "Microsoft.SMS.TsProgressUI" | |
$T1.CloseProgressDialog() | |
DO | |
{ | |
$wshell = New-Object -ComObject Wscript.Shell | |
$wshell.Popup("Please Connect AC Power - Click OK to Continue",0,"CONNECT MAINS POWER",0) | |
} | |
until (Get-WmiObject -Query "Select BatteryStatus from Win32_Battery WHERE BatteryStatus=2") | |
$T1.OpenProgressDialog() | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment