$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"