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.In 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.