VMware Cloud Community
rbutter
Contributor
Contributor

Mass Add Moved VMs to Inventory


I copied about 50 VMs from one datastore to the other and tried to run Luc D.'s script to add them back to inventory and I just got UUID strings in inventory.  If I add add them manually it asks the question Moved or Copied It.  How can I answer the Moved or Copied question in the PowerCLI script to add these VMs back to inventory without doing each one individually?

0 Kudos
7 Replies
LucD
Leadership
Leadership

Would this help ? How to Keep or Disgard the UUID when powering on a VM


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

0 Kudos
rbutter
Contributor
Contributor

Luc,

I'm not sure that helps.  When i run the PowerCLI script to add the VMs to inventory this is what shows up in the inventory view:  safs://vmfs_uuid:528a3df4-20fde165-86a6-14feb5c683ad/VM Name/VM Name (invalid).  Not sure what is happening.  If I use vmkfstools to look at the vmdk uuid's of the VMs they are all unique.

0 Kudos
LucD
Leadership
Leadership

It looks as if the datastore path(s) in the VMX file are incorrect (see KB2013832).

It looks as if the copy that you did will also need to update the content of the VMX files to correct the datastore path(s).


You could edit the VMX file, correct the datastore paths, before registering the VMX file.

In 1.  Re: Need to remove advanced values from VMX file I show a method to edit the content of a VMX file

Let me know if you need more help with the script ?

If yes, a sample VMX file would be handy.


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

0 Kudos
rbutter
Contributor
Contributor

Luc,

  If I log into the ESXi host the uuid of that datstore is correct and the path is /vmfs/volumes/528a3df4-20fde165-86a6-14feb5c683ad/VM Name/VM Name.vmx. I will look at the path in the vmx files.

Thanks

0 Kudos
rbutter
Contributor
Contributor

Luc,

  The only path to a datastore I see in the VMX file is for the swap file.  Please excuse my ignorance as I am very new to all of this.  It seems that if I can use the Vpshere Client to add these VMs to inventory successfully that a script should do the same thing. The only difference I get is when I power a manual add up it asks if it was moved or copied but, not all of them ask that.

0 Kudos
LucD
Leadership
Leadership

Did you try to run the Get-VMQuestion cmdlet against 1 of these VM (after you powered it on) ?

If there is an outstanding question, you can then answer that question with the Set-VMQuestion cmdlet (see Example 3)

Does that fix the problem ?


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

0 Kudos
rbutter
Contributor
Contributor

Luc,

The only time I get a choice to answer the question is when I manually add the VM to inventory.  When I run the script and add all of the VMs in the datastore to inventory each VM displays in the inventory as sanfs://vmfs_uuid:Datastore ID/VM Name/VM name (Invalid).  If I try to power one of these on I get an error message.  I'll get that error message in here tomorrow as we are currently recovering from a massive power outage.

Thanks!

0 Kudos