# Usage: Set-ExecutionPolicy RemoteSigned CurrentUser
# ./proxy.ps1
$currentWi = [Security.Principal.WindowsIdentity]::GetCurrent()
$currentWp = [Security.Principal.WindowsPrincipal]$currentWi
if( -not $currentWp.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
$boundPara = ($MyInvocation.BoundParameters.Keys | foreach{
'-{0} {1}' -f $_ ,$MyInvocation.BoundParameters[$_]} ) -join ' '
$currentFile = (Resolve-Path $MyInvocation.InvocationName).Path
$fullPara = $boundPara + ' ' + $args -join ' '
Start-Process "$psHome\powershell.exe" -ArgumentList "$currentFile $fullPara" -verb runas
return
}
$PkgDir = "$env:USERPROFILE" + "\AppData\Local\Packages"
$Pkgs = Get-Childitem -Path $PkgDir
ForEach ($Pkg in $Pkgs) {
Write-Host "Adding package " -NoNewline
Write-Host -ForegroundColor yellow "$($Pkg.Name)" -NoNewline
Write-Host " to loopback exempt list..."
CheckNetIsolation.exe LoopbackExempt -a -n="$($Pkg.Name)"
}
Write-Host "`nOperatoration Done."