PS3 MOL: Lab Questions CH 14.9 get-CimClass error

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Jeff Taylor Jeff Taylor 1 year, 4 months ago.

  • Author
  • #34872
    Profile photo of Jeff Taylor
    Jeff Taylor

    having trouble getting ex 1 working :

    Lab answer says: Get-CimClass win32_networkadapterconfiguration | select -expand methods | where Name -match "dhcp"

    which errors on "methods"

    Get-CimClass win32_networkadapterconfiguration | select -expand method |
    where Name -match "dhcp"

    which errors on "method"

    select : Property "methods" (or "method") cannot be found.

  • #34873
    Profile photo of Richard Siddaway
    Richard Siddaway

    It should be

    Get-CimClass Win32_networkadapterconfiguration | select -ExpandProperty CimClassMethods | where Name -match "dhcp"

    try running

    Get-CimClass Win32_networkadapterconfiguration

    and you'll see the two major groups are
    CimClassMethods and CimClassProperties

    You could simplify the code to
    (Get-CimClass Win32_networkadapterconfiguration).CimClassMethods | where Name -match "dhcp"

  • #34876
    Profile photo of Jeff Taylor
    Jeff Taylor

    ah! CimClassMethods

    thanks Richard,


You must be logged in to reply to this topic.