VMware Cloud Community
TheVMinator
Expert
Expert
Jump to solution

Find VM Name from OS Hostnsme

Assuming that I know only the operating system host name, and I know that the virtual machine name is completely different from the OS host name, how can I query vcenter and find the virtual machine name that is associated with this operating system host name?

Thanks!

i.e

$hostname = ”windowshostname”

get-vm | where-object{$_.something? -eq $hostname}

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Provided you have the VMware Tools installed on the VM, you can do

$hostname = ”windowshostname”

Get-VM | where-object {$_.Guest.HostName -eq $hostname}


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

View solution in original post

0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

Provided you have the VMware Tools installed on the VM, you can do

$hostname = ”windowshostname”

Get-VM | where-object {$_.Guest.HostName -eq $hostname}


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

0 Kudos
TheVMinator
Expert
Expert
Jump to solution

Perfect thanks!

0 Kudos