VMware Cloud Community
vJoeG
Hot Shot
Hot Shot

Scripting batch import of VM's using vmx

Good afternoon all,

We've been scripting the migration of VM's from an older 5.5 vCenter to 6.5 vCenter

Using PowerShell we've created a way to copy all of the folders into the new Datastore and want to automate the import as well.

Cannot use the Migration fling as our source environment is 5.5 and the fling requires 6.0u3 vCenter

The command in question is

new-vm -VMFilePath "[Datastore] MigrationVMs/EDE-900##/EDE-900##.vmx" -VMHost ourhost1.domain.com -Location MigratedVMs

When this is run from script or command line the error is:

"new-vm : 5/23/2019 1:45:16 PM    New-VM    The operation for the entity "MigratedVMs" failed with the following message: "A specified parameter was not correct: path"

This blog was where I took the code sample.

http://www.wooditwork.com/2011/08/11/adding-vmx-files-to-vcenter-inventory-with-powercli-gets-even-e...

Thanks in advance

------------------
Joe Graziano
Senior Solution Engineer - EUC Federal
VCP7-DTM, VCP6-DM, VCP6-DCV
vExpert, vExpertPro
jgraziano@vmware.com
0 Kudos
23 Replies
LucD
Leadership
Leadership

I understand.
Not sure if a restart of either could solve the issue, but if it is allowed, why not.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
vJoeG
Hot Shot
Hot Shot

So we rebooted the vCenter but not the hosts (yet) as the client was not comfortable bouncing the hosts.

We also tried connecting directly to hosts instead of the vCenter with the same results.

Calling it a weekend for now. I appreciate the help thus far! Thanks Luc.

------------------
Joe Graziano
Senior Solution Engineer - EUC Federal
VCP7-DTM, VCP6-DM, VCP6-DCV
vExpert, vExpertPro
jgraziano@vmware.com
0 Kudos
vJoeG
Hot Shot
Hot Shot

Oh.My.Goodness

So we looked and looked again at all the items of the command and finally after 'Quadruple' checking we found a Typo in the parent folder where the VM's live

Good name "MigrationVMs"

Name in the command "MigrationVM" it was missing the damn 'S' :smileyshocked:

We're working again! Have a great weekend

#DarnTypos

------------------
Joe Graziano
Senior Solution Engineer - EUC Federal
VCP7-DTM, VCP6-DM, VCP6-DCV
vExpert, vExpertPro
jgraziano@vmware.com
0 Kudos
LucD
Leadership
Leadership

All's well that ends well :smileygrin:


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos