Skip to content

Instantly share code, notes, and snippets.

@psycalc
Last active May 25, 2016 20:09
Show Gist options
  • Save psycalc/85da506e77d38d76c7de44a5a64b016a to your computer and use it in GitHub Desktop.
Save psycalc/85da506e77d38d76c7de44a5a64b016a to your computer and use it in GitHub Desktop.
# Перезапустить скрипт/консоль как администартор с параметрами
if(-not([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{
$Arguments = "& '" + $MyInvocation.MyCommand.Definition + "'"
Start-Process powershell -Verb RunAs -ArgumentList $Arguments
Break
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment