Powershell Script not going to next line

Mabrito

Supreme [H]ardness
Joined
Dec 24, 2004
Messages
7,004
I have a PowerShell script that is using HyperV CMDlets and I am exporting VM's. I have multiple Export statements for each VM needing export (Can't pipe a Get-VM into it as I am not exporting all the VM's).

When it finishes exporting the VM, PowerShell isnt processing the next export statement until I press Ctrl + C. I thought this was a Break command in Powershell...why would it not be jumping to the next line automatically?
 
Well it sounds like the previous command is not "finished" or returned execution.
 
Yeah, sounds to me like it isn't done exporting, yet. If you want to do them all at once, or let the export run in the background, try adding the -AsJob switch.
 
Some cmdlets also have "-wait" or "-nowait" parameters that you can use.

The "-asjob" suggestion is good, just make sure that you have your complete script receive the jobs in the end to identify errors and overall completion. You may also want to consider an export concurrency limit.
 
Back
Top