Add self-removal to bootstrap-Windows.ps1
This commit is contained in:
parent
2dea6fce1f
commit
379c081144
@ -11,11 +11,16 @@ if (-Not $IsElevated) {
|
||||
Invoke-WebRequest -Uri https://get.scoop.sh -OutFile $ScoopInstaller
|
||||
&$ScoopInstaller -ScoopDir "$env:LocalAppData/Scoop" -ScoopGlobalDir "$env:ProgramData/Scoop"
|
||||
|
||||
$Bootstrap = $MyInvocation.MyCommand.Path
|
||||
$Decision = $Host.UI.PromptForChoice('Relaunch as Administrator', 'Proceed?', $Choices, 0)
|
||||
if ($Decision -eq 0) {
|
||||
$Bootstrap = $MyInvocation.MyCommand.Path
|
||||
Start-Process powershell.exe "-ExecutionPolicy ByPass -NoProfile -File $Bootstrap" -Verb RunAs
|
||||
}
|
||||
|
||||
$Decision = $Host.UI.PromptForChoice("Remove $Bootstrap", "Proceed?", $Choices, 1)
|
||||
if ($Decision -eq 0) {
|
||||
Remove-Item $Bootstrap -Force
|
||||
}
|
||||
} else {
|
||||
Write-Host "Running as Administrator. Performing privileged actions."
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user