mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-27 07:38:03 +08:00
28 lines
664 B
PowerShell
28 lines
664 B
PowerShell
|
param(
|
||
|
[string]$AdminUserPassword = $null
|
||
|
)
|
||
|
|
||
|
$ErrorActionPreference = 'Stop'
|
||
|
$ProgressPreference = 'SilentlyContinue'
|
||
|
if (-Not [string]::IsNullOrEmpty($AdminUserPassword)) {
|
||
|
$PsExecPath = 'C:\PsExec64.exe'
|
||
|
$PsExecArgs = @(
|
||
|
'-u',
|
||
|
'AdminUser',
|
||
|
'-p',
|
||
|
$AdminUserPassword,
|
||
|
'-accepteula',
|
||
|
'-i',
|
||
|
'-h',
|
||
|
'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe',
|
||
|
'-ExecutionPolicy',
|
||
|
'Unrestricted',
|
||
|
'-File',
|
||
|
$PSCommandPath
|
||
|
)
|
||
|
|
||
|
Write-Host "Executing: $PsExecPath $PsExecArgs"
|
||
|
$proc = Start-Process -FilePath $PsExecPath -ArgumentList $PsExecArgs -Wait -PassThru
|
||
|
exit $proc.ExitCode
|
||
|
}
|