Hi
Hi want to call another a Powershell script from within my current script and run it with elevated credentials. Ideally I want to hit a break point in the second script or at least capture the output.
$targetScriptPath = Join-Path $scriptFolder "\HelloWorld.ps1"
Start-Process $PSHOME\powershell.exe `
-Credential $wizzyAccountCredentials `
-ArgumentList "-Command Start-Process $PSHOME\powershell.exe -ArgumentList `"'$targetScriptPath'`" -Verb Runas" -Wait
The script seems to run and I do get my second PS window but I don't see any of my test Write_Host commands. Feel free to suggest any improvements to the above script.
Daniel