VMware Cloud Community
olegarr
Enthusiast
Enthusiast
Jump to solution

Find VM's (datastore's, folder's, pool's and etc.) ID by name

Hello:

I am wondering if there is a way to find VM's (esx's, datastore's, folder's, pool's and etc.) ID by name from vSphere Power CLI.

The goal is to find ID of VM if name if known (and the same for esx, datastore, folder, pool and etc.).

Thanks,

Olegarr

0 Kudos
1 Solution

Accepted Solutions
jeveenj
Enthusiast
Enthusiast
Jump to solution

Hi,

As per my understanding, we can get managed object ID of VMs,

$serv = Connect-VIServer -Server

Write-Output $vm.Id

Similarly with others, like first Get-VMHost, store it to a variable then variable.Id gives you the Id.

Hope this helps.

-If you found this information useful, please consider awarding points for Correct or Helpful.

View solution in original post

0 Kudos
3 Replies
jeveenj
Enthusiast
Enthusiast
Jump to solution

Hi,

As per my understanding, we can get managed object ID of VMs,

$serv = Connect-VIServer -Server

Write-Output $vm.Id

Similarly with others, like first Get-VMHost, store it to a variable then variable.Id gives you the Id.

Hope this helps.

-If you found this information useful, please consider awarding points for Correct or Helpful.
0 Kudos
olegarr
Enthusiast
Enthusiast
Jump to solution

Jeveenj,

Thanks a lot!

It actually helped a lot!!!

olegarr

0 Kudos
AnatolyVilchins
Jump to solution

Have you looked at the powercli command reference (Clicky)?

It's very straightforward, I'm not entirely clear exactly what you're

trying to achieve but more than likely it's the get-vm commmandlet tree

you'll be looking at.

from http://serverfault.com/questions/104565/find-vms-datastores-folders-pools-and-etc-id-by-name

Starwind Software Developer

www.starwindsoftware.com

Kind Regards, Anatoly Vilchinsky