' Enable DHCP
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each objNetAdapter In colNetAdapters
errEnable = objNetAdapter.EnableDHCP()
Next
ASKER
ASKER
ASKER
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery _
("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled=True")
For Each objNetAdapter in colNetAdapters
For Each strAddress in objNetAdapter.IPAddress
arrOctets = Split(strAddress, ".")
If arrOctets(0) = "10" and arrOctets(1) = "0" and arrOctets(2) = "16" and arrOctets(3) <= "1"
Then
errEnable = objNetAdapter.EnableDHCP()
If errEnable = 0 Then
WScript.Echo "The IP address of your pc has been changed. Contact AM for restoring it back"
Else
WScript.Echo "The IP address could not be changed.Contact AM"
End If
End If
Next
Next
ASKER
ASKER
ASKER
Windows Server 2008 and Windows Server 2008 R2, based on the Microsoft Vista codebase, is the last 32-bit server operating system released by Microsoft. It has a number of versions, including including Foundation, Standard, Enterprise, Datacenter, Web, HPC Server, Itanium and Storage; new features included server core installation and Hyper-V.
TRUSTED BY
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery _
("Select * From Win32_NetworkAdapterConfig
For Each objNetAdapter in colNetAdapters
For Each strAddress in objNetAdapter.IPAddress
arrOctets = Split(strAddress, ".")
If arrOctets(0) = "10" and arrOctets(1) = "0" and arrOctets(2) = "16" and arrOctets(3) <=
"1"Then
errEnable = objNetAdapter.EnableDHCP()
If errEnable = 0 Then
WScript.Echo "The IP address of your pc has been changed. Contact AM for restoring it back"
Else
WScript.Echo "The IP address could not be changed.Contact AM"
End If
End If
Next
Next