Some time ago I wrote “Batch file that requires administrative privileges“
For Powershell it can be done easier
#from http://serverfault.com/a/12306/107224function Run-Elevated ($scriptblock ){# TODO: make -NoExit a parameter# TODO: just open PS (no -Command parameter) if $scriptblock -eq ”$sh = new-object -com ‘Shell.Application’$sh. ShellExecute(‘powershell’, “-NoExit -Command $scriptblock “, ”, ‘runas’)}Run-Elevated “cd $PSScriptRoot; ActualScript.ps1 ; Read-Host -Prompt `”Press_Enter_to_continue`” ”