VMware Cloud Community
MicroMarket
Contributor
Contributor

How im can locate the virtual machine by the local path?

Dear Friends

im have some Datastore Paths that the name is different than the name of the virtual machine´s

Then, how can do a command to check what  is the virtual machine of this data store path  ????

Thanks

Almir Fiorio

0 Kudos
4 Replies
Sivaramsharmar
Enthusiast
Enthusiast

Can you try like below and let me know it matches your requirement.

$vms = get-vm

$info = @()

foreach($vm in $vms){

$info += Get-HardDisk $vm  | select @{N='Name';E={$vm.Name}},FileName

}

$info | Export-csv c:\VMpath.csv -notypeinformation

0 Kudos
LucD
Leadership
Leadership

Are these VMs still registered, or are these orphaned VMs ?


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

0 Kudos
MicroMarket
Contributor
Contributor

Dear LucD

     all VM are in vcenter and are registered and have Vmotion

Thanks

Almir

0 Kudos
MicroMarket
Contributor
Contributor

Sivaramsharmar escreveu:

Can you try like below and let me know it matches your requirement.

$vms = get-vm

$info = @()

foreach($vm in $vms){

$info += Get-HardDisk $vm  | select @{N='Name';E={$vm.Name}},FileName

}

$info | Export-csv c:\VMpath.csv -notypeinformation

Great

but I want to Otherwise,

im need to search for the datastore name and inform if have any vm attached to this datastore?

Thanks

Almir

0 Kudos