A. Using the CodePlex Hyper-V module referenced in FAQ "Q. Is there a PowerShell set of cmdlets for Hyper-V outside of using VMM?" you can use the Import-VM cmdlet. Combine this with logic to list every folder in a path to create a command to import every VM in a folder (assuming each VM is in its own child folder). Notice that you use the -Wait switch for the Import-VM to import only one VM at a time.
Get-ChildItem e:\virtuals | Where-Object { $_.Attributes -band [System.IO.FileAttributes]::Directory } | ForEach-Object {Import-VM -path $_.FullName -ReuseIDs -Wait}
0 comments
Hide comments