I\'ve got a script that\'s I want to run as a scheduled task, but it\'s not doing the thing it\'s supposed to. I\'m trying to call an executable with Start-Process and the -
Can't tell you why it's doing it, but I think this might work around it:
$proc = Start-Process -FilePath "C:\Pfx Engagement\Admin\Utilities\Backup Restore\BackupRestoreUtil.exe" -ArgumentList "/f "$backup_directory"" -Passthru
do {start-sleep -Milliseconds 500}
until ($proc.HasExited)
The -Passthru switch will make it return a Process object for the process, and you can test that to see when the process has exited.