Files
AndroidDeviceStreaming/deploy/windows/prepare-agent.ps1
T

9 lines
531 B
PowerShell

$ErrorActionPreference = 'Stop'
$root = [System.IO.Path]::GetFullPath((Join-Path $env:LOCALAPPDATA 'AndroidDeviceStreaming/agent'))
New-Item -ItemType Directory -Path $root -Force | Out-Null
$sid = [System.Security.Principal.WindowsIdentity]::GetCurrent().User.Value
$grant = '*' + $sid + ':(OI)(CI)F'
icacls $root /inheritance:r /grant:r $grant '*S-1-5-18:(OI)(CI)F' '*S-1-5-32-544:(OI)(CI)F'
if ($LASTEXITCODE -ne 0) { throw 'Cannot protect deployment directory ACL' }
Write-Output "Prepared private deployment directory: $root"