Przejdź do treści

Powershell – Uruchamianie skryptu z uprawnieniami Administrator

Komenda

$powershell_sc_location = Get-Location | select -ExpandProperty "Path";
$powershell_sc_location = Get-Item $MyInvocation.ScriptName;
$powershell_sc_name     = split-path $MyInvocation.PSCommandPath -Leaf;

# Print script name with path
Write-Host $powershell_sc_location;

$powershell_sc_location = "$powershell_sc_location ";

# Print script name
Write-Host $powershell_sc_name ;

# Run skrypt as Admin
Start-Process powershell -ArgumentList $powershell_sc_location -Verb RunAs;

Dodaj komentarz

Twój adres email nie zostanie opublikowany. Wymagane pola są oznaczone *