Categories

Testing the network speed

In the last post I showed how to use the MSNdis_LinkSpeed class. Digging into the class information I found a suggestion that the speed returned was in Kbps. The answers didn’t look right especially when they suggested my wireless network was running at 540Mbps!

At bit of experimentation produced this

function test-linkspeed{            
param(            
 [string]$computer="."            
)            
            
Get-WmiObject -Namespace root\wmi -Class MSNdis_LinkSpeed `
-ComputerName $computer |             
foreach {            
 $nic = Get-WmiObject -Class Win32_NetworkAdapter `
 -ComputerName $computer -Filter "Name = '$($_.InstanceName)'"            
            
New-Object -TypeName PSObject -Property @{            
 Name = $_.InstanceName            
 NdisLinkSpeed = $_.NdisLinkSpeed            
 TestNdis = $_.NdisLinkSpeed / 10000            
 Speed = $nic.Speed            
 Test = $nic.Speed / 1000000            
} | select Name, NdisLinkSpeed, TestNdis, Test, Speed            
            
}            
            
}


Use the MSNdis_LinkSpeed class as before. Pipe into foreach and get the corresponding Win32_NetworkAdapter class. I know that the speed reported there is in bits per second. Create an object that shows the speeds reported by the two classes, convert Win32_NetworkAdapter speed to Mbps and play around with the divisor for Ndis speed until it matches. Turns out MSNdis_LinkSpeed reports in 100s of bits per second.



Odd but fun

Leave a Reply