Author Posts

February 4, 2016 at 1:34 pm

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.

February 4, 2016 at 1:41 pm

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"

February 4, 2016 at 2:13 pm

ah! CimClassMethods

thanks Richard,