#***************************************************************************************
# Written by Michael Pomfret
#
# This script checks whether the script is running as admin, if not then starts as admin.
#
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
}
cls
Write-Host -f Cyan “Red ugly warning about set-executionPolicy..”
sleep 2
Write-Host -f Green “OK”
Write-Host “”