To totally unlock this section you need to Log-in
Login
Let's think a bit about the following scenario: we have a DHCP server, nowadays is usually a virtualized server on a virtual infrastructure like VMware or HyperV, and we want to create a second "sleeping" DHCP server on another server, maybe physical, to use in case the virtual machine on which the DHCP server fails.
NOTE: this solution has been tested on two Windows Server 2008 servers, but it'll work even on Windows Server 2003 or Windows Server 2012 infrastructure.
For this configuration we'll need, first, to replicate/migrate the actual DHCP server configuration from the actual DHCP server on the new server (on which the DHCP has been already installed, but is disabled).
To do this you can read the following article, on HeelpBook: Migrate or duplicate DHCP role in Windows Domain.
Procedure
On the server on which we'll replicate the existing DHCP role could be a domain controller or even a member server, preferably joined in the same domain as the existing DHCP server.
After the backup and restore of the existing DHCP server on the new DHCP server we'll have to:
Dim strTarget, strPingResults
strTarget = "172.17.1.33"
Set WshShell = WScript.CreateObject("WScript.Shell")
Set WshExec = WshShell.Exec("ping -n 3 -w 1000 " & strTarget) 'send 3 echo requests, waiting 1 sec each
strPingResults = LCase(WshExec.StdOut.ReadAll)
If InStr(strPingResults, "reply from") Then
Wscript.Quit(0)
Else
StartDHCP
End If
Private Function StartDHCP()
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colServiceList = objWMIService.ExecQuery _
("Select * from Win32_Service where Name='DHCPServer'")
For each objService in colServiceList
errReturn = objService.StartService()
Next
Wscript.Sleep 20000
Set colServiceList = objWMIService.ExecQuery("Associators of " _
& "{Win32_Service.Name='DHCPServer'} Where " _
& "AssocClass=Win32_DependentService " & "Role=Dependent" )
For each objService in colServiceList
objService.StartService()
Next
End Function
Now we'll have to configure the account that will run properly the task and this is the SYSTEM account.
After this last configuration you can test the scheduled script by changing the IP address in the same script file (with a non-existent IP device/client) and checking if the DHCP Server service is started in the services.msc console:
Have you ever encountered the scenario in which DHCP is unavailable and you have several (if not all) users correctly connected (but in this case with wrong IP addresses) to LAN but they can’t reach internet, mail services or applications through network? If you want to avoid this scenario you could create a second (or more) DHCP server/s that will be activated if the current DHCP server is down or unreachable.
Read how on HeelpBook.net!
Failovering a DHCP server by Ping from another server – http://heelpbook.altervista.org/2014/failovering-a-dhcp-server-by-ping-from-another-server/ #failover #microsoft #dhcp #ping #tutorial #howto