Managing Wireless Network Adaptors with Powershell and WMI

Posted by & filed under Powershell, Programming, Projects, TNSC, Windows.

I have been researching how to create a script that will display network status as well as allow the users to reconnect to the wireless network if needed.

PS C:\Windows\system32> Get-WmiObject -Namespace root\wmi -list | Where-Object { $_.Name -match "MSNdis_80211" }

NameSpace: ROOT\wmi

Name Methods Properties
---- ------- ----------
MSNdis_80211_ReceiveAntennaSelected {} {Active, InstanceName, Ndis80211ReceiveAntennaSelected}
MSNdis_80211_RTSThreshold {} {Active, InstanceName, Ndis80211RTSThreshold}
MSNdis_80211_AddWEP {} {Active, InstanceName, KeyIndex, KeyLength...}
MSNdis_80211_ConfigurationInfo {} {ATIMWindow, BeaconPeriod, ConfigLength, DSConfig...}
MSNdis_80211_ReloadDefaults {} {Active, InstanceName, Ndis80211ReloadDefaults}
MSNdis_80211_BssIdListScan {} {Active, InstanceName, UnusedParameter}
MSNdis_80211_InfrastructureMode {} {Active, InstanceName, Ndis80211InfrastructureMode}
MSNdis_80211_ConfigurationFH {} {DwellTime, FHLength, HopPattern, HopSet}
MSNdis_80211_BaseServiceSetIdent... {} {Active, InstanceName, Ndis80211MacAddress}
MSNdis_80211_ReceivedSignalStrength {} {Active, InstanceName, Ndis80211ReceivedSignalStrength}
MSNdis_80211_NetworkType {} {Ndis80211NetworkType}
MSNdis_80211_PrivacyFilter {} {Active, InstanceName, Ndis80211PrivacyFilter}
MSNdis_80211_TransmitPowerLevel {} {Active, InstanceName, Ndis80211TransmitPowerLevel}
MSNdis_80211_NetworkInfrastructure {} {Ndis80211NetworkInfrastructure}
MSNdis_80211_WLanBssId {} {Ndis80211Configuration, Ndis80211InfrastructureMode, Ndis8...
MSNdis_80211_NetworkTypesSupported {} {Active, InstanceName, Ndis80211NetworkTypes, NumberOfItems}
MSNdis_80211_NetworkTypeInUse {} {Active, InstanceName, Ndis80211NetworkTypeInUse}
MSNdis_80211_RemoveWEP {} {Active, InstanceName, Ndis80211KeyIndex}
MSNdis_80211_NumberOfAntennas {} {Active, InstanceName, Ndis80211NumberOfAntennas}
MSNdis_80211_AuthenticationMode {} {Active, InstanceName, Ndis80211AuthenticationMode}
MSNdis_80211_FragmentationThreshold {} {Active, InstanceName, Ndis80211FragmentationThreshold}
MSNdis_80211_Statistics {} {ACKFailureCount, Active, FailedCount, FCSErrorCount...}
MSNdis_80211_BSSIList {} {Active, InstanceName, Ndis80211BSSIList, NumberOfItems}
MSNdis_80211_WEPStatus {} {Active, InstanceName, Ndis80211WEPStatus}
MSNdis_80211_PowerMode {} {Active, InstanceName, Ndis80211PowerMode}
MSNdis_80211_Configuration {} {Active, InstanceName, Ndis80211Config}
MSNdis_80211_ServiceSetIdentifier {} {Active, InstanceName, Ndis80211SsId}
MSNdis_80211_TransmitAntennaSele... {} {Active, InstanceName, Ndis80211TransmitAntennaSelected}
MSNdis_80211_Disassociate {} {Active, InstanceName, UnusedParameter}
MSNdis_80211_DataRates {} {Active, InstanceName, Ndis80211DataRate}
MSNdis_80211_DesiredDataRates {} {Active, InstanceName, Ndis80211DesiredRate}
MSNdis_80211_ReceivedSignalStren... {} {Active, InstanceName, Ndis80211ReceivedSignalStrengthTrigger}

And also this snippet which will display the network adapters labeled as wireless:

PS C:\Windows\system32> Get-WmiObject -Class Win32_NetworkAdapter | Where-Object {$_.Name -like "*Wireless*"}

ServiceName :
MACAddress :
AdapterType :
DeviceID : 14
Name : Linksys Wireless-G USB Network Adapter
NetworkAddresses :
Speed :

Sources: www.powershellcommunity.org/Forums/tabid…
blogs.technet.com/b/heyscriptingguy/arch…

Wireless Network Scanner in Powershell: defaultset.blogspot.com/2010/04/powershe…