Skip to content
Snippets Groups Projects
Verified Commit e8d79c9d authored by Julian Ospald's avatar Julian Ospald :tea:
Browse files

Warn when powershell script is run as admin

Fixes #163
parent 59e1eee8
No related branches found
No related tags found
No related merge requests found
......@@ -150,6 +150,15 @@ function Exec
$ErrorActionPreference = 'Stop'
$elevated = ([Security.Principal.WindowsPrincipal] `
[Security.Principal.WindowsIdentity]::GetCurrent()
).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
if ($elevated) {
Print-Msg -color Yellow -msg ('This script should not be run as administrator/elevated. Waiting 10s before continuing anyway...')
Start-Sleep -s 10
}
$GhcupBasePrefixEnv = [System.Environment]::GetEnvironmentVariable('GHCUP_INSTALL_BASE_PREFIX', 'user')
if ($GhcupBasePrefixEnv) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment