Pages

Wednesday, May 9, 2012

Retrieving a user’s virtual desktop information based on their Active Directory user name with View PowerCLI in VMware View 5.0

Retrieving a user’s virtual desktop information based on their Active Directory user name isn’t too difficult to do within the VMware View Administrator GUI as you can always click on the Desktops node under Inventory and then search for the user’s user name under the Filter text field:

image

With that being said, I’ve always found the View Administrator console to be a bit sluggish and sometimes I just want to quickly determine what a user’s desktop name is so instead of navigating around the GUI and waiting for the screens to refresh, I prefer to open up View PowerCLI and execute the following command:

Get-DesktopVM | where-object {$_."user_displayname" -match "someDomain.com\\ccsadmin"}

***Note that you’ll need to replace someDomain.com with the appropriate domain and the double \\ is required because the \ is a special character and to use it, you’ll need to put an additional one in front of it. 

Executing this command will provide you with the following information:

  • vm
  • ps_object_type
  • id
  • vc_id
  • Name
  • UnescapedName
  • Path
  • GuestFullName
  • GuestID
  • HostName
  • IPAddress
  • machine_id
  • user_sid
  • user_displayname
  • isInPool
  • pool_id
  • isLinkedClone
  • composerTask
  • localState

image

I don’t find the reset command used to hard reboot the virtual desktops all that useful but that’s one cmdlet that allows you to pipe the information returned from the Get-DesktopVM cmdlet so if you wanted to reboot a user’s desktop in View PowerCLI, you can execute the following command:

Get-DesktopVM | where-object {$_."user_displayname" -match "someDomain.com\\ccsadmin"} | Send-VMReset

1 comment:

Anonymous said...

Hi,
thats are nice Infos, thanks ;)
Unfortunately the localstate field is always blank, do you have any resolution to find the current state of a VM?
thx