I'm trying to run a script as another user who as admin right. I'm using the Start-Process command but my code didn't work at all.
My code :
$PassKey = [byte]95,[...],19,20,96,82
$Password= Get-Content .\PassKey.txt | Convertto-SecureString -Key $PassKey
$User="%COMPUTERNAME%\MyAdmAccount"
$Credentials=New-Object -TypeName "System.Management.Automation.PSCredential" -ArgumentList $User, $Password
Start-process powershell.exe -Argumentlist "C:\Users\test\Desktop\test_echo.ps1" -credential $Credentials
I havn't got any error code during the execution..
Thanks for your help :)