Backup DHCP logs from the DHCP server
A script to save DHCP logfiles more than One Week on a Windows server 2008 R2. It will also delete files older than XX days and Dump the DHCP database to a text-file in the logfolder. Schedule the script to run once a day. #************************************************************** # # Script Name: dhcpBackup.ps1 # Version: 1.0 # Author: Per Wiberg, Headworks Consulting # # Description: Used to backup DHCP logs from the DHCP server # to another location for archiving purposes. # Deletes logfiles that´s older than 30 Days # #***************************************************************** # Parameters $DHCPBackupPath = "C:\DHCP-LogFiles-Path" $DHCPServerName = "\\Server1" $DHCPPath = "C:\Windows\System32\dhcp" $Path = C:\DHCP-LogFiles-Path" $Daysback = "-30" #Remove Files older than the $limit. Remove "Whatif" to actiwait $CurrentDate = Get-Date $DatetoDelete = $CurrentDate.AddDays($Da