Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

start powershell as different user

$user = "domainservice.account" 
$pwd1 = "big long huge string of characters"
$pwd = ($pwd1 | ConvertTo-SecureString)
$Credential = New-Object System.Management.Automation.PSCredential $user, $pwd
$args = "domain.locallocationlocationlocationScriptscript.ps1"
Start-Process powershell.exe -Credential $Credential -ArgumentList ("-file $args")
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #start #powershell #user
ADD COMMENT
Topic
Name
5+9 =