Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

DNS SERVER Backup Script

$
0
0

I am writing a DNS server backup script with additional options. 

Backing Up DNS Server Daily
Create a folder based on current date
Copy the backup from source to newly created folder based on date

Complicated part (well, for me anyway :) )

keeping current month's backup (30 different copies/Folder of backup for each day)
Create a folder every calender month and and copy all 30 copies of backups within this folder
Email Results of copying process either success or failed

So Far i have the following which covers half of what is required! 

$date =Get-Date-Format yyyyMMddNew-Item C:\dnsbk\DNSBackup$date-ItemTypeDirectory
$1st =Export-DnsServerZone-Name test.ac.uk -Filename backup\test.ac.uk.bk 
$2nd =Export-DnsServerZone-Name _msdcs.test.ac.uk -FileName backup\_msdcs.test.ac.uk.bk
$source ="C:\windows\system32\dns\*"
$destination ="C:\dnsbk\DNSBackup$date"
$copy =Copy-Item-Recurse $source $destination
$successSubject ="Backup Completed Successfully"

$SuccessBody ="$1st,$2nd,$copy"<<<<<<This does not work >>>>>Send-MailMessage-From"admin@test.ac.uk"-To"jbloggs@test.ac.uk"-Subject $successSubject -SmtpServer192.168.0.1-Body $SuccessBody

Viewing all articles
Browse latest Browse all 6937

Latest Images

Trending Articles



Latest Images