-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.ps1
31 lines (27 loc) · 1.05 KB
/
run.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
try
{
cd $PSScriptRoot
Enable-PSRemoting -SkipNetworkProfileCheck
if ((Get-WSManInstance -ResourceURI winrm/config/service/auth).Negotiate -ne 'true')
{
Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WSMAN\Service -Name auth_negotiate -Value 1 -Type DWord
Restart-Service WinRM
}
$shouldResetUac = $false
$uacProperty = Get-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System | Select-Object -ExpandProperty LocalAccountTokenFilterPolicy
if ($uacProperty -ne 1)
{
$shouldResetUac = $true
Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System -Name LocalAccountTokenFilterPolicy -Value 1 -Type DWord
}
& msys64\usr\bin\sh.exe ./run.sh
}
finally
{
if ($shouldResetUac)
{
Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System -Name LocalAccountTokenFilterPolicy -Value 0 -Type DWord
}
Write-Host -NoNewLine 'Press any key to continue...';
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
}