i am having a code shown below. When i execute this code i want start-Process should wait. Once it is executed i will be accessing th exit code through $process. But here it is not working properly.
$process=Start-Process powershell -Verb runAs "$exePath ${args} " #Run as administrator
Write-Output "hello world"
Write-Output $process.exitCode