Jump to content
  • 0

PowerShell command for exporting "VirtualMachinePath'' to CSV file?


Nick Eizmendi

Question

Posted

I'm trying to import machines into a machine catalog, but I have no idea how to formulate the required [VirtualMachinePath]. I was hoping to export a list of our existing VMs, but I cannot figure how to do that either. Documentation is scarce. Hypervisor is ESXi/VCenter.

4 answers to this question

Recommended Posts

  • 0
Posted (edited)

In the add machines to catalog wizard, add a machine from the VM path that you are interested in manually, but don't finish the process. Instead, hit the export list and it will give you a CSV file with the correct format.

Edited by Dwayne Dorau
Spelling
  • Like 1
  • 0
Posted

you would actually identify this by looking at the machine catalog and adding one machine manually to the catalog and then export the list, which will provide you the exact VM path. However there is no direct mechanism to get the VM path for all the machines in that hosting connection.
 

  • 0
Posted

I did ended up working out a script to get the Cluster name associated to the VM which you could then utilize to update the Virtual Machine Path manually in the CSV File.

$VMstoAdd=Get-Content C:\temp\VMstoAdd.txt

foreach($VM in $VMstoMigrate){ (Get-Cluster -VM $VM).Name }

 

Once you have identified the cluster just use the Virtual Machine Path for your respective hosting connection and amend  the path with the cluster name received for the respective VM from the above script.

image.thumb.png.a17ba290cbc8e06a019cae42b2f1d790.png

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...