Skip to content

Instantly share code, notes, and snippets.

@r0ckbeard
r0ckbeard / Backup-DNSZoneData.ps1
Last active February 20, 2026 15:43 — forked from compwiz32/Backup-DNSZoneData.ps1
DNS backup script with logging and error handling
<#
.SYNOPSIS
DNS Backup Script.
.DESCRIPTION
This script connects to a specified DNS server, retrieves DNS zone and forwarder information, exports the zones and forwarders to files,
compresses the files, and performs cleanup operations. It logs all actions and sends an email notification if an error occurs.
.PARAMETER LogFilePath
The path to the log file where script actions and messages will be recorded. If run from ISE script pane with "Run selection", log file will be saved to C:\Temp\Backup