Friday, July 22, 2005

Discovering Networking with Monad and MSH

Monad presents administrators with great features and facilities, but there is a learning curve. One key aspect of learning any new feature or product is the aspect of "discoverability" - the ability to find things out simply. There are several ways to discover things, but the built-in reflection methods are at hand to help (although getting used to Monad and>.NET is a learning curvre!).

With Windows XP, there are over 900 WMI classes returned from the Get-WmiObject -List command, as shown:


[C:\]: $wmi=Get-WmiObject -list
[C:\]: $wmi.length
920
[C:\]: $wmi | format-list
(... a long list not shown!)

WMI class names are relativey self explanatory - so to find all the WMI classes that have 'net' or 'networking', you can do the following:

[C:\]: $netsettings = $wmi | where {$_.__PATH -match "net"}
[C:\]: $networksettings = $wmi | where {$_.__PATH -match "network"}

You can then use these to get the key network class names, as follows:

[C:\]: $netsettings.length
89
[C:\]: $networksettings.length
14
[C:\]: $networksettings | ft __Path

__Path
------
\\KAPOHO61\ROOT\cimv2:Win32_TSNetworkAdapterSettingError
\\KAPOHO61\ROOT\cimv2:Win32_NetworkClient
\\KAPOHO61\ROOT\cimv2:Win32_NetworkProtocol
\\KAPOHO61\ROOT\cimv2:CIM_NetworkAdapter
\\KAPOHO61\ROOT\cimv2:Win32_NetworkAdapter
\\KAPOHO61\ROOT\cimv2:Win32_NetworkConnection
\\KAPOHO61\ROOT\cimv2:Win32_PerfRawData_Tcpip_NetworkInterface
\\KAPOHO61\ROOT\cimv2:Win32_PerfFormattedData_Tcpip_NetworkInterfac
\\KAPOHO61\ROOT\cimv2:Win32_SystemNetworkConnections
\\KAPOHO61\ROOT\cimv2:Win32_TSNetworkAdapterSetting
\\KAPOHO61\ROOT\cimv2:Win32_TSNetworkAdapterListSetting
\\KAPOHO61\ROOT\cimv2:Win32_NetworkLoginProfile
\\KAPOHO61\ROOT\cimv2:Win32_NetworkAdapterConfiguration
\\KAPOHO61\ROOT\cimv2:Win32_NetworkAdapterSetting

Once you have these names, you can begin exploring:

[C:\]: $nw=Get-WMIObject Win32_NetworkAdapter
[C:\]: $nw.length
31
[C:\]: $nw | gm
(long display - deleted)

No comments: