Last active
August 7, 2020 06:44
-
-
Save moddingg33k/508d86900eabe29f9211e43528cfb500 to your computer and use it in GitHub Desktop.
This file contains 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
$currentIdentity = [Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent() | |
$isAdministrator = $currentIdentity.IsInRole([Security.Principal.WindowsBuiltInRole]'Administrator') | |
if (-not $isAdministrator) { | |
$Arguments = ('& ''{0}''' -f $MyInvocation.MyCommand.Definition) | |
Start-Process PowerShell.exe -Verb RunAs -ArgumentList $Arguments | |
break | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment