Musings on the splendour of PowerShell Creating a Windows Server 2012 DHCP Failover Relationship - PoSh Chap - Site Home - TechNet Blogs

PoSh Chap

Musings on the splendour of PowerShell

Creating a Windows Server 2012 DHCP Failover Relationship

Creating a Windows Server 2012 DHCP Failover Relationship

  • Comments 4
  • Likes

Here's my quick and simple recipe for creating a Windows Server 2012 DHCP failover relationship.

The following ingredients are required:

  • two Windows Server 2012 DHCP servers with the DHCP role installed
  • two or more scopes already configured as type DHCP on the first DHCP server

 All set? Good, let's cook...

 

Let's configure a Hot-Standby relationship with the first DHCP server as the primary server. First, get the scopes on HALODHCP01:

$Scopes = Get-DhcpServerv4Scope -ComputerName HALODHCP01

 

Next, create the Hot-Standy relationship:

Add-DhcpServerv4Failover -Name "HALO_FAILOVER" -ScopeID $Scopes[0].ScopeID -ComputerName HALODHCP01 -PartnerServer HALODHCP02 -ServerRole Active -AutoStateTransition $True -SharedSecret "8DKSZfF31Q" -Force

 

Now, check the failover out:

Get-DhcpServerv4Failover -ComputerName HALODHCP01

 

Here's stage two - add any additional scopes to the failover. First, get a list of scopes, ignoring the one we used to create the failover:

$ScopeObjects = $Scopes | Select-Object -Skip 1

 

Next, add those scopes to the failover relationship:

$ScopeObjects | ForEach-Object {Add-DhcpServerv4FailoverScope -Name "HALO_FAILOVER" -ComputerName HALODHCP01 -ScopeId $_.ScopeID}

 

Finally, list the scope that are part of the relationship:

(Get-DhcpServerv4Failover -ComputerName HALODC02).ScopeID.IPAddressToString

 

Quick and easy, unlike Lobster Thermidor.

 

Comments
  • Thanks
    always interesting

  • hey btw
    isn't there a typo here:
    HALODHCP001
    HALODHCP01
    ?

  • There sure is! Thank you :)

  • thanks.

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment