11Feb/112
Changing Computers IP Addresses with VBScript
So now that we changed the machine name and user names we might need to change some IP's....
As you can see below you will need to specify the IP's somehow (hard coded right now) with a MSGBOX, Registry read, text file, Machine name etc
'----------------------------------------------------------------------
const HKLM = &H80000002
Set WshShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set oNetwork = CreateObject("WScript.Network")
strCurrentComputerName = oNetwork.ComputerName
'Setup IP's you want to implament, you can add logic for MSGBOX etc.
strComputer = "."
IPAddress = "10.11.12.13"
dGateway = "10.11.12.11"
arrIPAddress = Array(IPAddress)
arrSubnetMask = Array("255.255.255.128")
arrGateway = Array(dGateway)
arrDNSServers = Array("12.107.200.146")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each objNetAdapter in colNetAdapters
errEnableStatic = objNetAdapter.EnableStatic(arrIPAddress, arrSubnetMask)
errGateways = objNetAdapter.SetGateways(arrGateway)
intSetDNSServers = objNetAdapter.SetDNSServerSearchOrder(arrDNSServers)
Next
If intSetDNSServers = 0 Then
MSGBOX("Server IPs set to: IPAddress = " & IPAddress)
Else
MSGBOX("Error setting server info.")
End If
Print This Post
Pingback: Google Analytics Search Terms For My Sites - Yeshai Bouskila