mirror of
https://github.com/ntdevlabs/tiny11builder.git
synced 2025-12-18 09:24:12 +00:00
Adminstrator-running-fallback-patch
A few months ago, in the readme, we changed the `Set-Execution` policy to a process scoped one to avoid users exposing their machine. That induces a new problem. When we start the script without administrator rights, but with the `Set-Executionpolicy` scoped to `Process`, the script restarts itself with elevated rights but in the previously set execution policy (likely `RemoteSigned`). This patch passes : - NoProfile - ExecutionPolicy Bypass - NoExit - File To the newly created process.
This commit is contained in:
parent
00e7d8a151
commit
768c476b4d
1 changed files with 2 additions and 1 deletions
|
|
@ -19,7 +19,7 @@ if (! $myWindowsPrincipal.IsInRole($adminRole))
|
||||||
{
|
{
|
||||||
Write-Host "Restarting Tiny11 image creator as admin in a new window, you can close this one."
|
Write-Host "Restarting Tiny11 image creator as admin in a new window, you can close this one."
|
||||||
$newProcess = new-object System.Diagnostics.ProcessStartInfo "PowerShell";
|
$newProcess = new-object System.Diagnostics.ProcessStartInfo "PowerShell";
|
||||||
$newProcess.Arguments = $myInvocation.MyCommand.Definition;
|
$newProcess.Arguments = "-NoProfile -ExecutionPolicy Bypass -NoExit -File `"$($myInvocation.MyCommand.Definition)`"";
|
||||||
$newProcess.Verb = "runas";
|
$newProcess.Verb = "runas";
|
||||||
[System.Diagnostics.Process]::Start($newProcess);
|
[System.Diagnostics.Process]::Start($newProcess);
|
||||||
exit
|
exit
|
||||||
|
|
@ -577,3 +577,4 @@ elseif ($input -eq 'n') {
|
||||||
else {
|
else {
|
||||||
Write-Host "Invalid input. Please enter 'y' to continue or 'n' to exit."
|
Write-Host "Invalid input. Please enter 'y' to continue or 'n' to exit."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue