Automation

 View Only
  • 1.  bug with Get-CDDrive

    Posted Sep 10, 2008 08:57 PM

    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)



  • 2.  RE: bug with Get-CDDrive

    Posted Sep 11, 2008 06:03 AM

    I seem to have this problem with -expandProperty globally.

    See for example



  • 3.  RE: bug with Get-CDDrive

    Posted Sep 11, 2008 02:06 PM

    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)



  • 4.  RE: bug with Get-CDDrive
    Best Answer

    Posted Sep 12, 2008 02:12 PM

    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.



  • 5.  RE: bug with Get-CDDrive

    Posted Sep 25, 2008 09:02 AM

    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