Skip to content
This repository has been archived by the owner on Sep 11, 2021. It is now read-only.

Commit

Permalink
Merge pull request #142 from cookieguru/patch-1
Browse files Browse the repository at this point in the history
Make non-admin error message less specific
  • Loading branch information
felixrieseberg committed Jun 23, 2019
2 parents 763c2ff + 7c40ae8 commit c05501a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions powershell/upgrade-npm.ps1
Expand Up @@ -104,10 +104,15 @@ function UpdateNpm($PassedNodePath)
# ---------------------------------------------------------------------------------------------------------
if (!(IsAdministrator))
{
"NOTADMIN"
"Please restart this script from an administrative PowerShell!"
"NPM cannot be upgraded without administrative rights. To run PowerShell as Administrator,"
"right-click PowerShell and select 'Run as Administrator'"
$parentpid=(gwmi win32_process -Filter "processid='$pid'").parentprocessid
if((Get-Process -id $parentpid).Name -eq "cmd") {
$env = "command prompt"
} else {
$env = "PowerShell"
}

"Please restart this script from an administrative $env"
"NPM cannot be upgraded without administrative rights."
return
}

Expand Down

0 comments on commit c05501a

Please sign in to comment.