Information Technology Reference
In-Depth Information
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set adapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each adapter In adapters
errEnable = adapter.EnableDHCP()
WScript.Echo "Successfully enabled DHCP on interface"
Next
How It Works
For ease of administration, you can use DHCP to provide IP address configuration information
to a Windows Server 2003 computer. A computer that is relying on DHCP will request an IP
address when it first boots, using a four-step process:
The computer broadcasts a DHCPDiscover packet, requesting an IP address from any
DHCP server on the network.
1.
A DHCP server broadcasts a DHCPOffer packet containing a valid IP address from its
scope of addresses, as well as any configuration information that the administrator has
configured to go along with the IP address. (This packet is still sent using broadcasts
because the requesting computer doesn't actually have an IP address yet.)
2.
3.
The computer that requested the IP address will send a DHCPRequest packet in response
to the first DHCPOffer packet it receives, requesting use of that particular IP address.
This is a unicast packet, sent to the IP address of the DHCP server whose DHCPOffer
packet was accepted.
The DHCP server that received the DHCPRequest packet will respond with a DHCPAcknowledge
packet, certifying that it will be using this particular IP address and configuration. This
is also a unicast packet sent directly to the client computer.
4.
Note It may seem odd to refer to a Windows Server 2003 computer as a “client computer.” In this case,
“client” refers to the fact that the Windows Server 2003 computer is requesting resources (an IP address)
from another computer that is “serving” those resources. So a computer can function as both a client and a
server, regardless of what operating system it is running.
A DHCP server sends an IP address and subnet mask to a requesting computer in the form
of a DHCP lease . This lease specifies for how long the IP address is valid before the requesting
computer will be required to contact the DHCP server again to renew its lease. In addition to
an IP address and subnet mask, a DHCP lease can contain several DHCP options to further
customize the client computer's TCP/IP configuration. These options can include configura-
tion information such as the following:
Search WWH ::




Custom Search