Created
May 22, 2025 07:16
-
-
Save scriptingstudio/3e3ee514a24e463de2ef371cfaa9f763 to your computer and use it in GitHub Desktop.
Culture invariant admin privileges test in cmd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| powershell.exe -executionpolicy bypass -noninteractive -nologo -noprofile -command "&{ If (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {write-warning 'You must run this script as an Administrator!'; cmd.exe /c pause; exit 1000} }" | |
| if ERRORLEVEL 1000 goto :EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment