X-Git-Url: https://vilimpoc.org/repos/dotfiles/blobdiff_plain/7d4887fe245e7643a497e87e04fc8f97d8ca436f..99725a30bdb3eee44c38e1fd9a28c060341aa058:/setup-windows.bat?ds=sidebyside diff --git a/setup-windows.bat b/setup-windows.bat index 5dc46e6..1d32ada 100644 --- a/setup-windows.bat +++ b/setup-windows.bat @@ -56,10 +56,15 @@ set "DOTNET_EXE=%ProgramFiles%\dotnet\dotnet.exe" @rem --- Elevated installs (VS2022, WDK, system tools) --- @rem The elevated script runs in its own window and logs to setup-windows-uac.log. @rem -PassThru + $p.ExitCode propagates its real exit code back through to ERRORLEVEL. +@rem +@rem -TraceUser passes YOU across the UAC boundary. Accepting that prompt with an +@rem administrator's credentials runs the elevated half AS that administrator, so +@rem it cannot see whose box this is; the account named here is the one it grants +@rem non-elevated ETW collection rights to (xperf / wpr without a UAC prompt). set "UAC_LOG=%~dp0setup-windows-uac.log" if exist "%UAC_LOG%" del "%UAC_LOG%" -powershell -NoProfile -Command "$p = Start-Process powershell -Verb RunAs -ArgumentList '-NoProfile','-ExecutionPolicy','Bypass','-File','""%~dp0setup-windows-with-uac.ps1""' -Wait -PassThru; exit $p.ExitCode" +powershell -NoProfile -Command "$p = Start-Process powershell -Verb RunAs -ArgumentList '-NoProfile','-ExecutionPolicy','Bypass','-File','""%~dp0setup-windows-with-uac.ps1""','-TraceUser','""%USERDOMAIN%\%USERNAME%""' -Wait -PassThru; exit $p.ExitCode" set "UAC_RC=%ERRORLEVEL%" @rem --- Surface the elevated session's output (its window has already closed) ---