![]() ![]() I have removed comments from code snippets here for better readability. The class code is not optimized but should work on most Windows systems (tested on XP and 7 64bit). MACAddress (returns MAC address if device is connected)Įxample application shows how to make and use of MSLoopbackTool utility class.NetConnectionStatus (for connection info).ConfigManagerErrorCode (for device state info).NetConnectionID (returns connection name). ![]() Be aware that many of this class's properties are not available on every Windows version. The full documentation link is here: (VS.85).aspx. It provides some useful properties used in example code to get connection name, instance ID and adapter state information. The WMI class Win32_NetworkAdapter represents an IPv4 network adapter. For XP it is usually faster when used on disabled device (because of DHCP request). Note that for Vista and 7 (64bit) network adapter must be enabled before setting IP. Where 'name' is a NIC's connection name (can be obtained with WMI), '192.168.0.3' is an IP and '255.255.255.0' is a mask.ĭepending on Windows version this command can return "Ok." string if succeed or nothing. Netsh int ip set address name="Local Area Connection 2" static 192.168.0.3 255.255.255.0 (single line command) According to online documentation "Netsh is a command-line scripting utility that allows you to, either locally or remotely, display or modify the network configuration of a computer that is currently running." More information is available here: (WS.10).aspx. To configure static IP address use Netsh command (standard Windows utility).
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |