Set objShell = CreateObject("Wscript.Shell")
Dim strComputer, objWMIService, colNetAdapters, strIPAddress, strSubnetMask, errEnable, objNetAdapter
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
strIPAddress = Array("192.168.1.26")
strSubnetMask = Array("255.255.254.0")
For Each objNetAdapter in colNetAdapters
errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
If errEnable = 0 Then
msgbox "successful setting IP."
Else
msgbox "Failed to set IP."
End if
Next
Dim strComputer, objWMIService, colNetAdapters, strIPAddress, strSubnetMask, errEnable, objNetAdapter
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
strIPAddress = Array("192.168.1.26")
strSubnetMask = Array("255.255.254.0")
For Each objNetAdapter in colNetAdapters
errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
If errEnable = 0 Then
msgbox "successful setting IP."
Else
msgbox "Failed to set IP."
End if
Next