DHCP backup with PowerShell.

Backup is a magical word for every admin. DHCP backup should be taken frequently to overcome any failures or configuration errors. Manual DHCP backup is a straight forward option but it is not easy if more number of DHCP servers available in our environment.DHCP backup powershellIn those situations, powershell acts as handy tool and we can create a powershell script to automate according to our requirement. ‘BACKUP-DHCPSERVER’ command can be used on DHCP server or client machines as follows:

$DHCPSERVER = “dhcp.https://amar365.com”          \\specify the name of DHCP server

$pathname = “D:\Backup\DHCP”                   \\Specify a backup path which should be local path inside the respective DHCP server or  UNC path.

Backup-DhcpServer -computername “$DHCPSERVER -path $pathname           \\ “-computername” parameter doesn’t require if you’re running this command directly inside DHCP server

To automate the process, create a task in task scheduler of DHCP server with required frequency and map the powershell script to the task. Successful backup will produce ‘DHCPCFG’ file and ‘new’ folder with MDB(database),pat&text files.

Download the script from here.

By AMARNATH K

AM@RNATH is a Technology specialist primarily focus on Microsoft Technologies & Cloud Security. His certification includes M365 Certified: Enterprise Admin Expert. He loves to explore things from the latest technologies to cooking new recipes. Basically from Chennai, the southern part of India. Lucky son, friendly husband, and a proud father who loves to spend time with his family & friends while the laptop is not in his table.

Leave a Reply

Your email address will not be published.