powershell wait for exe to finish code example

Example 1: 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)

Example 2: powershell allow execution

Select Start > All Programs > Windows PowerShell version > Windows PowerShell.
Type Set-ExecutionPolicy RemoteSigned to set the policy to RemoteSigned.
Type Set-ExecutionPolicy Unrestricted to set the policy to Unrestricted.
Type Get-ExecutionPolicy to verify the current settings for the execution policy.