How to configure static IP address with vbs
This article mainly explains "how to configure static IP address with vbs". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to configure static IP address with vbs".
Set the IP address of the computer to 192.168.1.141 and the IP gateway to 192.168.1.100.
Script code
The copy code is as follows:
StrComputer = "." Set objWMIService = GetObject ("winmgmts:\\" & strComputer & "\ root\ cimv2") Set colNetAdapters = objWMIService.ExecQuery _ ("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE") strIPAddress = Array ("192.168.1.141") strSubnetMask = Array ("255.255.255.0") strGateway = Array ("192.168.1.100") strGatewayMetric = Array (1) For Each objNetAdapter in colNetAdapters errEnable = objNetAdapter.EnableStatic (strIPAddress, strSubnetMask) errGateways = objNetAdapter.SetGateways (strGateway StrGatewaymetric) If errEnable = 0 Then WScript.Echo "The IP address has been changed." Else WScript.Echo "The IP address could not be changed." End If Next thank you for reading, the above is "how to use vbs to configure static IP address" content, after the study of this article, I believe you on how to use vbs to configure static IP address this problem has a deeper understanding, the specific use of the situation also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!