Skip to content

Instantly share code, notes, and snippets.

@PartTimeLegend
Created July 14, 2017 10:03
Show Gist options
  • Select an option

  • Save PartTimeLegend/0d9656ba94902ca6e19c66800f40bc8f to your computer and use it in GitHub Desktop.

Select an option

Save PartTimeLegend/0d9656ba94902ca6e19c66800f40bc8f to your computer and use it in GitHub Desktop.
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs;
exit
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment