diff --git a/apps/desktop/src-tauri/src/rustdesk.rs b/apps/desktop/src-tauri/src/rustdesk.rs index 7624ece..a29e3d7 100644 --- a/apps/desktop/src-tauri/src/rustdesk.rs +++ b/apps/desktop/src-tauri/src/rustdesk.rs @@ -642,9 +642,12 @@ if (-not (Test-Path '{target}')) {{ New-Item -ItemType Directory -Force -Path '{ $admins = (New-Object Security.Principal.SecurityIdentifier('S-1-5-32-544')).Translate([Security.Principal.NTAccount]).Value $localSvc = (New-Object Security.Principal.SecurityIdentifier('S-1-5-19')).Translate([Security.Principal.NTAccount]).Value takeown /F '{target}' /R /D Y | Out-Null -if ($LASTEXITCODE -ne 0) {{ exit $LASTEXITCODE }} +if ($LASTEXITCODE -ne 0) {{ $take = $LASTEXITCODE }} else {{ $take = 0 }} icacls '{target}' /grant "${{admins}}":(OI)(CI)F "${{localSvc}}":(OI)(CI)F /T /C | Out-Null -exit $LASTEXITCODE +$ica = $LASTEXITCODE +if (($take -eq 0) -and ($ica -in 0,1)) {{ exit 0 }} +if ($ica -ne 0) {{ exit $ica }} +exit $take "# ); run_powershell_elevated(&script)