I forget if I raised this before but I hit it again today so to be sure, here it is...I'm not sure how to explain this, so I'll just show it:
PS > (Get-VM vcenter* | Get-CDDrive).connectionstate AllowGuestControl Connected StartConnected ----------------- --------- -------------- True False False PS > Get-VM vcenter* | Get-CDDrive | select -expandProperty connectionstate Select-Object : Cannot expand property "connectionstate" because it has nothing to ex pand. At line:1 char:39 + Get-VM vcenter* | Get-CDDrive | select <<<< -expandProperty connectionstate
This technique works with every other object on the planet aside from CDDriveImpl.
Author of the upcoming book: Managing VMware Infrastructure with PowerShell
Co-Host, PowerScripting Podcast (http://powerscripting.net)
Hi all,
10x for the info. I'll log this in the bugtracking system so it get investigated. Once we isolate the problem I'll try to make a list with all VIToolkit objects that this does not work for.
I seem to have this problem with -expandProperty globally.
See for example
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks for posting that link, I knew we'd had this discussion before but I couldn't find it. But regardless, we haven't yet heard from VMware...
Here's an example of this working with another object
§ ATLLAPHROTTENBE {~} Get-VM | select -expandProperty cddrives -first 2 IsoPath : [SAN_VOL1] images/SLES-10-i386-GMC.iso HostDevice : RemoteDevice : ConnectionState : VMware.VimAutomation.Client20.ConnectInfoImpl Id : VirtualMachine-vm-385/3002 Name : CD/DVD Drive 1 IsoPath : HostDevice : RemoteDevice : ConnectionState : VMware.VimAutomation.Client20.ConnectInfoImpl Id : VirtualMachine-vm-463/3002 Name : CD/DVD Drive 1
Author of the upcoming book: Managing VMware Infrastructure with PowerShell
Co-Host, PowerScripting Podcast (http://powerscripting.net)
Hi all,
10x for the info. I'll log this in the bugtracking system so it get investigated. Once we isolate the problem I'll try to make a list with all VIToolkit objects that this does not work for.
Hi,
We did a litle research and this seems like a Powershell problem, which is resolved in Powershell 2. For example the problem with expanding the connection state of the cddrive object is not present when I tried to duplicate it it with Ps2. Something else, if you try:
$files = ls *.dll
$files[0] | select -expandproperty Directory, where the type of the Directory property is DirectoryInfo gives the same error with Ps1 and no error with Ps2.
Hope this will help.
Yavor