VMware Cloud Community
FAL-Moray
Contributor
Contributor

get-vm vs. get-vmguest?

hi all,

I am not sure if this is the correct forum but will ask anyway. I am learning powershell and looking at creating an script to report on resources usage of my very small VM environment and have noticed something unusual in my test environment.

I have a virtual ESX server running a single XP vm. The ESX server is on a host only network and I can connect to it using connect-viserver. When I run get-vm I get an expected response. However when I run get-vmguest the return is no information and a state of not running.

If I connect to my production ESX server and run get-vmguest I get all the corrent information.

There is not firewall on the XP vm or on my laptop.

As far as I can tell the security setting on both the virtual and physical ESX servers are the same.

I know I am missing something but what is it?

thank you,

Gord

0 Kudos
6 Replies
PaulSvirin
Expert
Expert

Could you show your scripts for the first and for the second approach?

---

iSCSI SAN software

--- iSCSI SAN software http://www.starwindsoftware.com
0 Kudos
maishsk
Expert
Expert

NAME

Get-VMGuest

SYNOPSIS

Retrieves the guest operating systems of the specified virtual machines.

Will give you these properties on the object

Disks

GuestId

HostName

IPAddress

Nics

OSFullName

ScreenDimensions

State

VmId

VmName

NAME

Get-VM

SYNOPSIS

Retrieves the virtual machines on a vSphere server.

Will get these properties on the object

CDDrives

CustomFields

DatastoreIdList

Description

DrsAutomationLevel

FloppyDrives

FolderId

Guest

HAIsolationResponse

HardDisks

HARestartPriority

Host

HostId

Id

MemoryMB

Name

NetworkAdapters

Notes

NumCpu

PowerState

ResourcePoolId

UsbDevices

VMHostId

VMSwapfilePolicy

They do two completely different things

Maish

Virtualization Architect & Systems Administrator

Maish Saidel-Keesing • @maishsk • http://technodrone.blogspot.com • VMTN Moderator • vExpert • Co-author of VMware vSphere Design
0 Kudos
FAL-Moray
Contributor
Contributor

hi all,

At this point there is no 'script' being run. My question is about the behavior of a virtual ESX server vs. a physical ESX server.

I am using connect-viserver and connect to the ESX servers one at a time. I can run get-vm on each server and get a listing of what VM is running on the ESX servers.

However when I run get-vmguest on the virtual ESX server I get no information about a VM. When I run get-vmguest when connected to the physical ESX server and use one of the VM running I get the expected details about the server.

My question is why? I am using the root account on the virutal ESX server and a user account that is a member of the root group on the physical server. Could this be causing the issue? How is get-vmguest resolving the VM name? I am wondering if the VM is question is not registered in my DNS (or Hosts file) could it be that command cannot find the VM?

Any other ideas? I would like to script against a virtual ESX server rather than my physical production server.

0 Kudos
maishsk
Expert
Expert

If I understand correctly..

When running get-vmguest against a Physical ESX you get results which has virtual machines you get results.

When running get-vmguest against a VM (Virtual ESX) you do not?

This could most probably be because of the the VMware Tools that ar installed in the VM. On an virtual ESX/i installation you cannot install VMware tools






Maish

Virtualization Architect & Systems Administrator

Maish Saidel-Keesing • @maishsk • http://technodrone.blogspot.com • VMTN Moderator • vExpert • Co-author of VMware vSphere Design
0 Kudos
RvdNieuwendijk
Leadership
Leadership

The Get-VMGuest cmdlet uses the VMware tools to retrieve the information. So my suggestion is that you need to install the VMware tools in the XP client on the virtual ESX server.

Regards, Robert

Message was edited by: RvdNieuwendijk

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
0 Kudos
FAL-Moray
Contributor
Contributor

ah - that explains my issue. I did try and install VM Tools on the VM running inside the virtual ESX server and got the "VM Tools can only be installed on a virutal machine" error.

I will do the majority of my script against the virtual ESX server and then fire up an older physical testbed to complete my testing before finally trying this against my physical production environment.

thank you all for the input.

Gord

0 Kudos