mike shaoul
asked on
Run script line by line
I am executing lines of a script …
foreach ($vm in $vms)
{Get-SerialPort -VM $vm | Remove-SerialPort -VM $vm }
foreach ($vm in $vms)
{Get-ParallelPort -VM $vm | Remove-ParallelPort -VM $vm }
However, I get an error message saying the parallelPort line could not run as the '{Get-SerialPort -VM $vm | Remove-SerialPort -VM $vm }' had not finished.
I added a "Start-Sleep -Milliseconds 3000" and the serial ports and parallelports are removed without error.
But I want an alternative fix, so the the script checks that '{Get-SerialPort -VM $vm | Remove-SerialPort -VM $vm }' is finished then proceeds to call "foreach ($vm in $vms)
{Get-ParallelPort -VM $vm | Remove-ParallelPort -VM $vm }"
How do I do that ?
foreach ($vm in $vms)
{Get-SerialPort -VM $vm | Remove-SerialPort -VM $vm }
foreach ($vm in $vms)
{Get-ParallelPort -VM $vm | Remove-ParallelPort -VM $vm }
However, I get an error message saying the parallelPort line could not run as the '{Get-SerialPort -VM $vm | Remove-SerialPort -VM $vm }' had not finished.
I added a "Start-Sleep -Milliseconds 3000" and the serial ports and parallelports are removed without error.
But I want an alternative fix, so the the script checks that '{Get-SerialPort -VM $vm | Remove-SerialPort -VM $vm }' is finished then proceeds to call "foreach ($vm in $vms)
{Get-ParallelPort -VM $vm | Remove-ParallelPort -VM $vm }"
How do I do that ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Sorry, added the OUt-null so it waits.