-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvariables.ps1
More file actions
17 lines (15 loc) · 808 Bytes
/
variables.ps1
File metadata and controls
17 lines (15 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$Global:ServiceName = "AutoPower"
$Global:Dir = "$($PSScriptRoot)\autopower.exe"
$Global:ProxyPath = "$($PSScriptRoot)\autopower_proxy.exe"
$Global:ProxyName = "AutoPower Proxy"
function Assert-Admin($script_definition) {
$User = [Security.Principal.WindowsIdentity]::GetCurrent()
$CurrentPrincipal = New-Object Security.Principal.WindowsPrincipal($User)
$IsAdmin = $CurrentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
if (-not $IsAdmin) {
Write-Output "Starting a new shell as admin..."
Write-Output "Sometimes this window will stay open even after install is finished."
Start-Process "powershell" -Wait -Verb RunAs -ArgumentList ('-ExecutionPolicy Bypass -noprofile -file "{0}" -elevated' -f ($script_definition))
exit
}
}