Modify IP
cmd /c netsh interface ip set address name="local connection" source=static addr=211.82.56.253 mask=255.255.255.0 gateway=211.82.56.1 gwmetric=1
Modify DNS
cmd /c netsh interface ip set dns name="local connection" source=static addr=202.99.192.66
Configure or update the IP address:
wmic nicconfig where index=0 call enablestatic("192.168.1.5"), ("255.255.255.0"); index=0 means that network interface 1 is configured.
Configure the gateway (default routing):
wmic nicconfig where index=0 call setgateways("192.168.1.1"),(1)
vbs
Const T_GATEWAY = "211.82.56.1" 'Gateway
Const T_NEWDNS1 = "202.99.192.66" 'DNS1
Const T_NEWDNS2 = "60.221.248.43" 'DNS2
strWinMgmt="winmgmts:{impersonationLevel=impersonate}"
Set NICS = GetObject( strWinMgmt ).InstancesOf("Win32_NetworkAdapterConfiguration")
For Each NIC In NICS
If Then
Array(T_NEWDNS1,T_NEWDNS2)
Array(T_GATEWAY)
End If
Next
cmd /c netsh interface ip set address name="local connection" source=static addr=211.82.56.253 mask=255.255.255.0 gateway=211.82.56.1 gwmetric=1
Modify DNS
cmd /c netsh interface ip set dns name="local connection" source=static addr=202.99.192.66
Configure or update the IP address:
wmic nicconfig where index=0 call enablestatic("192.168.1.5"), ("255.255.255.0"); index=0 means that network interface 1 is configured.
Configure the gateway (default routing):
wmic nicconfig where index=0 call setgateways("192.168.1.1"),(1)
vbs
Const T_GATEWAY = "211.82.56.1" 'Gateway
Const T_NEWDNS1 = "202.99.192.66" 'DNS1
Const T_NEWDNS2 = "60.221.248.43" 'DNS2
strWinMgmt="winmgmts:{impersonationLevel=impersonate}"
Set NICS = GetObject( strWinMgmt ).InstancesOf("Win32_NetworkAdapterConfiguration")
For Each NIC In NICS
If Then
Array(T_NEWDNS1,T_NEWDNS2)
Array(T_GATEWAY)
End If
Next