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 7 months, 3 weeks ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #34872
    Profile photo of Jeff Taylor
    Jeff Taylor
    Participant

    having trouble getting ex 1 working :

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

    which errors on "methods"

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

    which errors on "method"

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

    #34873

    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
    Participant

    ah! CimClassMethods

    thanks Richard,

    Jeff

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.