Skip to content

Instantly share code, notes, and snippets.

@danjpadgett
Last active April 2, 2019 09:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danjpadgett/1da2596ae3e3dc407731a4941ced8872 to your computer and use it in GitHub Desktop.
Save danjpadgett/1da2596ae3e3dc407731a4941ced8872 to your computer and use it in GitHub Desktop.
prompt for a/c power during in place upgrade.
##//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