I think what I need to do is to make sure that the System.Management link is set to Copy Local, but I canβt check it right now. If anyone has any better ideas, please feel free to let me know.
UPDATE:
You cannot use System.Management.dll in Windows 8.1 in the same way that it is used in Windows 7 or Windows 10.
I found that to perform operations similar to those that I mentioned in my question on Windows 8.1 and Windows 8, you need to either obtain a Windows 8.1 developer license or set the computer to "Developer Mode" on Windows 10, so you can use the space Windows.Networking.Connectivity Names:
string connectionProfileInfo = string.Empty; ConnectionProfile InternetConnectionProfile = NetworkInformation.GetInternetConnectionProfile(); if (InternetConnectionProfile == null) { rootPage.NotifyUser("Not connected to Internet\n", NotifyType.StatusMessage); } else { connectionProfileInfo = GetConnectionProfile(InternetConnectionProfile); OutputText.Text = connectionProfileInfo; rootPage.NotifyUser("Success", NotifyType.StatusMessage); } // Which calls this function, that allows you to determine how strong the signal is and the associated bandwidth string GetConnectionProfile(ConnectionProfile connectionProfile) { // ... if (connectionProfile.GetSignalBars().HasValue) { connectionProfileInfo += "====================\n"; connectionProfileInfo += "Signal Bars: " + connectionProfile.GetSignalBars() + "\n"; } // ... }
Please note that you must ensure that your project is a Windows 8.1 PCL or a Windows 8.1 application in order to be able to reference the namespace.
See https://code.msdn.microsoft.com/windowsapps/network-information-sample-63aaa201 for details
UPDATE 2:
To get the bandwidth in Windows 7, 8.1 and 10, I ended up using this code:
private int GetMaxBandwidth() { int maxBandwidth = 0; NetworkInterface[] networkIntrInterfaces = NetworkInterface.GetAllNetworkInterfaces(); foreach (var networkInterface in networkIntrInterfaces) { IPv4InterfaceStatistics interfaceStats = networkInterface.GetIPv4Statistics(); int bytesSentSpeed = (int)(interfaceStats.BytesSent); int bytesReceivedSpeed = (int)(interfaceStats.BytesReceived); if (bytesSentSpeed + bytesReceivedSpeed > maxBandwidth) { maxBandwidth = bytesSentSpeed + bytesReceivedSpeed; } } }
source share