I'm trying to retrieve the GuestFamily property from virtual machine guests. No luck from the PowerCLI client on my desktop, but another PowerCLI client (let's call it client2), which happens to be running on a vm server, retrieves this property just fine from the same infrastructure.
$x = get-vm $vmName
$x.guest.guestFamily
$members = $x.guest | gm
$members.count is 20 from my desktop and 24 from client2. The discrepant members are LockUpdates, UnlockUpdates, Client, and GuestFamily.
When I first noticed GuestFamily missing, my desktop was running PowerCLI 5.0 with the vCloud Director component of PowerCLI NOT installed. No change after upgrading PowerCLI, so I uninstalled and reinstalled PowerCLI, this time including the vCloud Director component. Now both clients have VMware vSphere PowerCLI 5.1 Release 1 build 793510. My desktop is in the same domain as Virtual Center, and client2 is in a different domain. Client2 runs 64bit Windows Server 2008R2 with Powershell 3.0. My desktop runs 64bit Windows 7 with Powershell 2.0. Any chance the GuestFamily property requires Powershell 3.0? Or what else am I missing here?
I just verified and the GuestFamily property was there in PowerCLI 5.0.1, but not in PowerCLI 5.1.
Are you sure you have PowerCLI 5.1 on both machines ?
Do a
Get-PowerCLIVersion
In any case, you can still get the value with
$x.Guest.ExtensionData.GuestFamily
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Are the permissions on that failing VM the same for the account you use to connect ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I had been using different accounts to connect to VC from each client, although the perms should be no different. To make sure, I just now tried switching the accounts, but the behavior stayed with the client rather than following the account used to connect VC. (In other words, I'd been using account1 to connect my desktop to VC and account2 to connect client2. Just now I tried using account2 from my desktop and account1 from client2; my desktop still fails to retrieve GuestFamily while client2 continues to return that property.)
From client2, PowerCLI retrieves GuestFamily for all vms I've tried. From my desktop, PowerCLI does not return GuestFamily for any vm. Naturally, I did try many of the same vms from both clients.
I just verified and the GuestFamily property was there in PowerCLI 5.0.1, but not in PowerCLI 5.1.
Are you sure you have PowerCLI 5.1 on both machines ?
Do a
Get-PowerCLIVersion
In any case, you can still get the value with
$x.Guest.ExtensionData.GuestFamily
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks, this works from both clients: $x.guest.ExtensionData.GuestFamily
And that's all I really need. But in case I'm not the only one interested in solving the mystery, here are results of get-powerCLIversion...
...from my desktop:
PowerCLI Version
----------------
VMware vSphere PowerCLI 5.1 Release 1 build 793510
---------------
Snapin Versions
---------------
VMWare AutoDeploy PowerCLI Component 5.1 build 768137
VMWare ImageBuilder PowerCLI Component 5.1 build 768137
VMware vCloud Director PowerCLI Component 1.5 build 793505
VMware License PowerCLI Component 5.1 build 669840
VMware vSphere PowerCLI Component 5.1 build 793489
...and from client2:
...at this point it sounds like the mystery is why PowerCLI 5.1 shows $x.guest.guestFamily on client2. I did run precompiling commands there, from the links below. I remember using VimService50 before realizing I needed 51, so I wonder if that did it.
http://vnugglets.com/2011/11/speed-up-first-powercli-5-cmdlet.html
One more question, is one a 32-bit client and the other a 64-bit client OS ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Both are 64bit clients, [System.Runtime.InterOpServices.Marshal]::SizeOf([System.IntPtr] returns 8.
Also tried the 32bit shell on each client computer, and the GuestFamily behavior matches the 64bit shells on each.
That is a very strange behaviour, and I can confirm that I see the same thing when I run the same script on a Win7 and W2K8R2 machine.
Perhaps someone from the PowerCLI Development Team has an idea and can give an explanation ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference