powershell run and wait code example
Example: powershell start a process and wait for it to finish
$proc = Start-Process -Wait -FilePath $procPath -ArgumentList $argument
do{sleep 1}while(Get-Process -Name $procName -ErrorAction SilentlyContinue)
$proc = Start-Process -Wait -FilePath $procPath -ArgumentList $argument
do{sleep 1}while(Get-Process -Name $procName -ErrorAction SilentlyContinue)