Skip to content

Instantly share code, notes, and snippets.

Last active Nov 6, 2015
What would you like to do?
Author: I.C.A. Strachan
Version History:
Purpose: Pester script to validate that DNS Zones and Records have been configured
[string]$fqdn ='domain.local',
[string[]]$ServerIPAddress= @('', '')
Import-Module DNSServer -Verbose:$false
Describe "DNS Exchange Configuration Test for $fqdn" {
$zoneNames = @(
Context 'DNS Zones' {
# Test every zone
foreach($zoneName in $zoneNames){
it "Has a zone named: $zoneName" {
Get-DnsServerZone $zoneName | Should Not BeNullOrEmpty
Context 'DNS Resource records' {
foreach ($IPAddress in $ServerIPAddress){
foreach($zoneName in $zoneNames){
It "Has IPAddress $($IPAddress) in zone $($zoneName)"{
(Get-DnsServerResourceRecord -ZoneName $zoneName | out-string) | Should Match $IPAddress
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment