{"id":153,"date":"2019-01-21T21:01:26","date_gmt":"2019-01-22T02:01:26","guid":{"rendered":"http:\/\/itblog.ldlnet.net\/?p=153"},"modified":"2019-01-21T21:01:26","modified_gmt":"2019-01-22T02:01:26","slug":"powerdns-script","status":"publish","type":"post","link":"https:\/\/itblog.ldlnet.net\/index.php\/2019\/01\/21\/powerdns-script\/","title":{"rendered":"PowerDNS Script"},"content":{"rendered":"\n<p>I was compiling some scripts to be able to modify DNS records in my previous post. While browsing through different scripts in the TechNet Gallery, I came across the following Script that provides a menu, options, and different settings which really make it a great script to use if you do a lot of DNS Modification and want to do it through PowerShell. <\/p>\n\n\n\n<p>Here is the <a rel=\"noreferrer noopener\" aria-label=\"link (opens in a new tab)\" href=\"https:\/\/gallery.technet.microsoft.com\/scriptcenter\/Lookup-Create-Delete-any-f23229b2\" target=\"_blank\"><font color=\"red\"><strong><em>link<\/em><\/strong><\/font><\/a> to the original script page, but I have updated and modified the script to include being able to add\/remove DNS Zones as well.<\/p>\n\n\n<pre class=\"lang:PowerShell\" title=\"PowerDNS.ps1\"><# Welcome to PowerDNS V1.0! This Script is prepared by Subhro Majumder. Modified by Lance Lingerfelt - LDLNET LLC. #> \n \n<# The script has been prepared and tested in Powershell 4.0. So when you run this script, please make sure that the Powershell version is 4.0 or above. #> \n \n<# Using this script , you can Look-Up, Create and Delete A,PTR and CNAME Records. You can also Look-Up, Create, and Remove DNS Zones.#> \n \n<# This script is suitable for single record entry as well as bulk entry. For every operation there are two options, Single and Bulk.  \n \nFor Bulk entry you need to create an input file in CSV format. Sample input files has been provided along with this script. #> \n \n<# While Deleting records, you will get a confirmation box for each record, to ensure that you are going to delete the correct record. #> \n \n<# While this script has been tested multiple times, I recommend that you test it in a test environment before using it in a production environment.#> \n \n<# While every attempt has been made to make this script error free, I will not take any responsibilty for any consequence that would happen while running the script.#> \n \n \nfunction Show-Menu \n \n{ \n \n \n     param ( \n           [string]$Title = 'Welcome to the PowerDNS! This is a one stop solution for all DNS related work' \n     ) \n     cls \n     Write-Host \"===== $Title =====\" -ForegroundColor Yellow\n     Write-Host \"                   \" \n      \n     Write-Host \"Using this script, you can Look-Up, Create and Delete A,PTR and CNAME Records. You can also Look-Up, Create, and Remove DNS Zones.\" -ForegroundColor Yellow\n     Write-Host \"                   \" \n     Write-Host \"The script has been prepared and tested in Powershell 4.0. So when you run this script, please make sure that the Powershell version is 4.0 or above.\" -ForegroundColor Yellow\n     Write-Host \"                   \" \n     Write-Host \"This script is suitable for single record entry as well as bulk entry. For every operation there are two options, Single and Bulk.\" -ForegroundColor Yellow\n     Write-Host \"                   \" \n     Write-Host \"For Bulk entry you need to create an input file in CSV format. Sample input files has been provided along with this script.\" -ForegroundColor Yellow\n     Write-Host \"                   \" \n     Write-Host \"While Deleting records\/zones, you will get a confirmation box for each record\/zone, to ensure that you are going to delete the correct record\/zone.\" -ForegroundColor Yellow\n     Write-Host \"                   \" \n     Write-Host \"While this script has been tested multiple times, I recommend that you test it in a test environment before using it in a production environment.\" -ForegroundColor Yellow\n     Write-Host \"                   \" \n     Write-Host \"While every attempt has been made to make this script error free, I will not take any responsibilty for any consequence that would happen while running the script.\" -ForegroundColor Yellow\n \n     Write-Host \"                   \" \n \n     Write-Host \"--------------MENU----------------\" -ForegroundColor Yellow\n     Write-Host \"                   \" \n     Write-Host \"1: Press 1 to Lookup DNS Records.\" -ForegroundColor DarkYellow\n     Write-Host \"                   \" \n     Write-Host \"2: Press 2 to Create Host Records.\" -ForegroundColor Green\n     Write-Host \"                   \" \n     Write-Host \"3: Press 3 to Create PTR Records.\" -ForegroundColor Green\n     Write-Host \"                   \" \n     Write-Host \"4: Press 4 to Create CNAME Records.\" -ForegroundColor Green\n     Write-Host \"                   \" \n     Write-Host \"5: Press 5 to Delete Host Records.\" -ForegroundColor Red\n     Write-Host \"                   \" \n     Write-Host \"6: Press 6 to Delete PTR Records.\" -ForegroundColor Red\n     Write-Host \"                   \" \n     Write-Host \"7: Press 7 to Delete CNAME Records.\" -ForegroundColor Red\n     Write-Host \"                   \"\n     Write-Host \"8: Press 8 to Create DNS Primary Zones.\" -ForegroundColor DarkGreen\n     Write-Host \"                   \"\n     Write-Host \"9: Press 9 to Create DNS Secondary Zones.\" -ForegroundColor DarkGreen\n     Write-Host \"                   \"\n     Write-Host \"10: Press 10 to Create DNS Stub Zones.\" -ForegroundColor DarkGreen\n     Write-Host \"                   \"\n     Write-Host \"11: Press 11 to Remove DNS Zones.\" -ForegroundColor Magenta\n     Write-Host \"                   \"    \n     Write-Host \"Q: Press 'Q' to quit this Program.\" -ForegroundColor Yellow\n     Write-Host \"----------------------------------\" -ForegroundColor Yellow\n     Write-Host \"                   \" \n \n} \n \nfunction Lookup-SingleDNS \n \n{ \n \ncls \n'You chose Single DNS Lookup' \n$input = Read-Host \"Please enter the value you want to look up\" \n \nResolve-DNSName -Name \"$input\" -nohostsfile -type All | ft Name,Type,TTL,IPAddress,NameExchange,Preference,Namehost,Strings -autosize \n\"                       \" \n\"                        \" \n  \n}  \n \nfunction Lookup-BulkDNS \n \n{ \n \ncls \n'You chose Bulk DNS Lookup' \n \n$inputfile = Read-Host \"Please enter the location of the input file\"\n \n$output1= Read-Host \"Please enter the location of the output file\" \n \n$records= Get-Content $inputfile \n  \nforeach ($record in $records) \n{ \n  \n$output=Resolve-DnsName -Name $record -NoHostsFile -Type ALL\n \n$output | ft Name,Type,TTL,IPAddress,NameExchange,Preference,Namehost,Strings | Out-File -FilePath $output1 -Append -NoClobber \n  \n  \n} \n \n} \n \n \nfunction Create-SingleHostEntry \n \n{ \n \nWrite-Host \"Please Note: While creating the Host Record, corresponding PTR Record will also be created.\" -ForegroundColor Yellow\n \n$dnsserver= Read-Host \"Please enter the DNS Server Name where you want to create the Record\"\n \n$zone= Read-Host \"Please enter the Zone Name\"\n \n$name= Read-Host \"Please enter the Record value (Without FQDN )\"\n \n$IP= Read-Host \"Please enter the IP Address\" \n \nAdd-DnsServerResourceRecordA -ComputerName $dnsserver -Name $name -ZoneName $zone -IPv4Address $IP -TimeToLive 05:00:00 -CreatePtr -Confirm \n \n \n} \n \nfunction Create-BulkHostEntry \n \n{ \n \nWrite-Host \"Please Note: While creating the Host Records, corresponding PTR Records will also be created.\" -ForegroundColor Yellow\n \n$dnsserver= Read-Host \"Please enter the DNS Server Name where you want to create the Record\"\n \n$zone= Read-Host \"Please enter the Zone Name\" \n \n$inputfile = Read-Host \"Please enter the location of the input file. Input file format is CSV. Include these headers: name,IP\" \n \nimport-csv -Path $inputfile | foreach-object {Add-DnsServerResourceRecordA -computername $dnsserver -Name $_.name -ZoneName $zone -IPv4Address $_.IP -TimeToLive 05:00:00 -CreatePtr -Confirm} \n \n \n} \n \n \nfunction Create-SinglePTREntry \n \n{ \n \n$dnsserver= Read-Host \"Please enter the DNS Server Name where you want to create the Record\"\n \n$zone= Read-Host \"Please enter the Reverse Zone Name\" \n\n$FQDN= Read-Host \"Please enter the record value (With FQDN )\" \n\n$IP= Read-Host \"Please enter the Host octects of the IP Address.Please do not include Network octets.\" \n \nAdd-DnsServerResourceRecord -ComputerName $dnsserver -Name $IP -PTR -ZoneName $zone -PtrDomainName $FQDN -TimeToLive 05:00:00 -Confirm \n \n} \n \nfunction Create-BulkPTREntry \n \n{ \n \n$dnsserver= Read-Host \"Please enter the DNS Server Name where you want to create the Record\"\n \n$zone= Read-Host \"Please enter the Reverse Zone Name\" \n \n$inputfile = Read-Host \"Please enter the location of the input file. Input file format is CSV. Include these headers: IP,FQDN\" \n \nImport-Csv -Path $inputfile| foreach-object { Add-DnsServerResourceRecord -ComputerName $dnsserver -Name $_.IP -PTR -ZoneName $zone -PtrDomainName $_.FQDN -TimeToLive 05:00:00 -Confirm} \n \n} \n \n \nfunction Create-SingleCNAMEEntry \n \n \n{ \n \n$dnsserver= Read-Host \"Please enter the DNS Server Name where you want to create the Record\"\n \n$alias= Read-Host \"Please enter the Alias Name\" \n\n$zonename= Read-Host \"Please enter the Zone Name\" \n\n$FQDN= Read-Host \"Please enter the FQDN for the alias\" \n \n \nAdd-DnsServerResourceRecord -CName -ComputerName $dnsserver -Name $alias -HostNameAlias $FQDN -ZoneName $zonename -TimeToLive 05:00:00 -Confirm \n \n} \n \n \nfunction Create-BulkCNAMEEntry \n \n{ \n \n$dnsserver= Read-Host \"Please enter the DNS Server Name where you want to create the Record\"\n \n$zonename= Read-Host \"Please enter the Zone Name\" \n \n$inputfile = Read-Host \"Please enter the location of the input file. Input file format is CSV: alias,FQDN.\" \n \nImport-Csv -Path $inputfile| foreach-object { Add-DnsServerResourceRecord -CName -ComputerName $dnsserver -Name $_.alias -HostNameAlias $_.FQDN -ZoneName $zonename -TimeToLive 05:00:00 -Confirm } \n \n  \n} \n \n \nfunction Delete-SingleHostEntry \n \n{ \n \nWrite-Host \"There can be multiple Host Records (IPs) for a given Host Name. Only one Record for the matching IP address will be deleted\" -ForegroundColor Yellow\nWrite-Host \"For Example: In contoso.com zone there are two records test.contoso.com > 192.168.1.23 and test.contoso.com > 192.168.1.24. This action removes only one of the entries of test.contoso.com, matching the IP address.\" -ForegroundColor Yellow\n \n$dnsserver= Read-Host \"Please enter the DNS Server Name from where you want to delete the Record\"\n \n$zonename= Read-Host \"Please enter the Zone Name\"\n \n$name= Read-Host \"Please enter the Host Record Name (Without FQDN)\" \n\n$IP= Read-Host \"Please enter the IP address of the Host Record which you want to delete\" \n \n \nRemove-DnsServerResourceRecord -computername $dnsserver -ZoneName $zonename -RRType \"A\" -Name $name -RecordData $IP -Confirm \n \n \n} \n \nfunction Delete-BulkHostEntry \n \n{ \nWrite-Host \"There can be multiple Host Records (IPs) for a given Host Name. Only one Record for the matching IP address will be deleted\" -ForegroundColor Yellow\nWrite-Host \"For Example: In contoso.com zone there are two records test.contoso.com > 192.168.1.23 and test.contoso.com > 192.168.1.24. This action removes only one of the entries of host.contoso.com, matching the IP address.\" -ForegroundColor Yellow\nWrite-Host \"                  \" \n \n$dnsserver= Read-Host \"Please enter the DNS Server Name from where you want to delete the record\"\n \n$zonename= Read-Host \"Please enter the Zone Name where the Record is located\" \n \n$inputfile = Read-Host \"Please enter the location of the input file. Input file format is CSV.Please include these Headers: name,IP.\" \n \n \nImport-Csv -Path $inputfile| foreach-object { Remove-DnsServerResourceRecord -computername $dnsserver -ZoneName $zonename -RRType \"A\" -Name $_.name -RecordData $_.IP -Confirm } \n \n \n} \n \n \nfunction Delete-SinglePTREntry \n \n{ \n \n$dnsserver= Read-Host \"Please enter the DNS Server Name from where you want to delete the record\"\n \n$zonename= Read-Host \"Please enter the Reverse Zone Name\" \n\n$IP= Read-Host \"Please enter the IP address of the PTR Record. Only the Host octet is required.\" \n \n \nRemove-DnsServerResourceRecord -computername $dnsserver -ZoneName $zonename -RRType \"PTR\" -Name $IP -Confirm \n \n} \n \n \nfunction Delete-BulkPTREntry \n \n{ \n \n$dnsserver= Read-Host \"Please enter the DNS Server Name from where you want to delete the record\" \n\n$zonename= Read-Host \"Please enter the Reverse Zone Name\" \n \n$inputfile = Read-Host \"Please enter the location of the input file. Input file format is CSV.Include the Header: IP.\" \n \n \nImport-Csv -Path $inputfile| foreach-object {Remove-DnsServerResourceRecord -computername $dnsserver -ZoneName $zonename -RRType \"PTR\" -Name $_.IP -Confirm} \n \n} \n \n \nfunction Delete-SingleCNAMEEntry \n \n \n{ \n \n$dnsserver= Read-Host \"Please enter the DNS Server Name from where you want to delete the record\" \n\n$zonename= Read-Host \"Please enter the Zone Name where the Alias Record is located.\" \n\n$name= Read-Host \"Please enter the Alias Name (Without FQDN)\" \n \n \nRemove-DnsServerResourceRecord -computername $dnsserver -ZoneName $zonename -RRType \"CNAME\" -Name $name -Confirm \n \n \n} \n \n \nfunction Delete-BulkCNAMEEntry \n \n \n{ \n \n$dnsserver= Read-Host \"Please enter the DNS Server Name from where you want to delete the record\" \n \n$zonename= Read-Host \"Please enter the Zone Name where the Alias Record is located.\" \n \n$inputfile = Read-Host \"Please enter the location of the input file. Input file format is CSV. Include the Header: aliasname.\" \n \n \nImport-Csv -Path $inputfile | foreach-object {Remove-DnsServerResourceRecord -computername $dnsserver -ZoneName $zonename -RRType \"CNAME\" -Name $_.alias -Confirm} \n \n \n} \n\nfunction Add-PrimaryDNSZoneEntry\n\n{\n\n$dnsserver= Read-Host \"Please enter the DNS Server Name from where you want to create the DNS zone\"\n\n$zonename= Read-Host \"Please enter the Primary DNS Zone Name you want to create. (i.e. ldlnet.local)\"\n\n$replicationScope= Read-Host \"Please enter the AD replication scope for the zone. (i.e. Forest, Domain, or Legacy)\"\n\n$dynamicupdate= Read-Host \"Please specify how the Zone accepts dynamic updates. (i.e. None, Secure, NonSecureAndSecure)\"\n\nAdd-DnsServerPrimaryZone -ComputerName $dnsserver -Name $zonename -ReplicationScope $replicationScope -DynamicUpdate $dynamicupdate -PassThru -Confirm:$true\n\n}\n\nfunction Add-PrimaryBulkDNSZoneEntry\n\n{\n\n$dnsserver= Read-Host \"Please enter the DNS Server Name from where you want to create the DNS zones\"\n\n$replicationScope= Read-Host \"Please enter the AD replication scope for the zone. (i.e. Forest, Domain, or Legacy)\"\n\n$dynamicupdate= Read-Host \"Please specify how the Zone accepts dynamic updates. (i.e. None, Secure, NonSecureAndSecure)\"\n\n$inputfile = Read-Host \"Please enter the full path of the input file. Input file format is CSV. Include the Header: zone.\" \n\nImport-Csv -Path $inputfile | foreach-object {Add-DnsServerPrimaryZone -ComputerName $dnsserver -Name $_.zone -ReplicationScope $replicationScope -DynamicUpdate $dynamicupdate -PassThru -Confirm:$true}\n\n}\n\nfunction Add-SecondaryDNSZoneEntry\n\n{\n\n$dnsserver= Read-Host \"Please enter the DNS Server Name from where you want to create the DNS zone\"\n\n$zonename= Read-Host \"Please enter the Secondary DNS Zone Name you want to create. (i.e. ldlnet.local)\"\n\n$replicationScope= Read-Host \"Please enter the AD replication scope for the zone. (i.e. Forest, Domain, or Legacy)\"\n\n$dynamicupdate= Read-Host \"Please specify how the Zone accepts dynamic updates. (i.e. None, Secure, NonSecureAndSecure)\"\n\nAdd-DnsServerSecondaryZone -ComputerName $dnsserver -Name $zonename -ReplicationScope $replicationScope -DynamicUpdate $dynamicupdate -PassThru -Confirm:$true\n\n}\n\nfunction Add-SecondaryBulkDNSZoneEntry\n\n{\n\n$dnsserver= Read-Host \"Please enter the DNS Server Name from where you want to create the DNS zones\"\n\n$replicationScope= Read-Host \"Please enter the AD replication scope for the zone. (i.e. Forest, Domain, or Legacy)\"\n\n$dynamicupdate= Read-Host \"Please specify how the Zone accepts dynamic updates. (i.e. None, Secure, NonSecureAndSecure)\"\n\n$inputfile = Read-Host \"Please enter the full path of the input file. Input file format is CSV. Include the Header: zone.\" \n\nImport-Csv -Path $inputfile | foreach-object {Add-DnsServerSecondaryZone -ComputerName $dnsserver -Name $_.zone -ReplicationScope $replicationScope -DynamicUpdate $dynamicupdate -PassThru -Confirm:$true}\n\n}\n\nfunction Add-StubDNSZoneEntry\n\n{\n\n$dnsserver= Read-Host \"Please enter the DNS Server Name from where you want to create the DNS zone\"\n\n$zonename= Read-Host \"Please enter the Stub DNS Zone Name you want to create. (i.e. ldlnet.local)\"\n\n$replicationScope= Read-Host \"Please enter the AD replication scope for the zone. (i.e. Forest, Domain, or Legacy)\"\n\n$ms= Read-Host \"Please specify the ip of the server that holds the authoritative records for the zone. (i.e. 192.168.3.107)\"\n\nAdd-DnsServerStubZone -ComputerName $dnsserver -Name $zonename -ReplicationScope $replicationScope -MasterServers $ms -PassThru -Confirm:$true\n\n}\n\nfunction Add-StubBulkDNSZoneEntry\n\n{\n\n$dnsserver= Read-Host \"Please enter the DNS Server Name from where you want to create the DNS zones\"\n\n$replicationScope= Read-Host \"Please enter the AD replication scope for the zone. (i.e. Forest, Domain, or Legacy)\"\n\n$ms= Read-Host \"Please specify the ip of the server that holds the authoritative records for the zone. (i.e. 192.168.3.107)\"\n\n$inputfile = Read-Host \"Please enter the full path of the input file. Input file format is CSV. Include the Header: zone.\" \n\nImport-Csv -Path $inputfile | foreach-object {Add-DnsServerStubZone -ComputerName $dnsserver -Name $_.zone -ReplicationScope $replicationScope -MasterServers $ms -PassThru -Confirm:$true}\n\n}\n\nfunction Remove-DNSZoneEntry\n\n{\n\n$dnsserver= Read-Host \"Please enter the DNS Server Name from where you want to remove the DNS zone\"\n\n$zonename= Read-Host \"Please enter the Stub DNS Zone Name you want to remove. (i.e. ldlnet.local)\"\n\n\nRemove-DnsServerZone -ComputerName $dnsserver -Name $zonename -PassThru -Confirm:$true -Verbose\n\n}\n\nfunction Remove-BulkDNSZoneEntry\n\n{\n\n$dnsserver= Read-Host \"Please enter the DNS Server Name from where you want to remove the DNS zones\"\n\n$inputfile = Read-Host \"Please enter the full path of the input file. Input file format is CSV. Include the Header: zone.\" \n\nImport-Csv -Path $inputfile | foreach-object {Remove-DnsServerZone -ComputerName $dnsserver -Name $_.zone -PassThru -Confirm:$true -Verbose}\n\n}\n \ndo \n{ \n     Show-Menu \n     $input = Read-Host \"Please make a selection\" \n     switch ($input) \n     { \n           '1' { \n                cls \n                'You have selected option #1' \n                'Press 1 for Single DNS Lookup' \n                'Press 2 for Bulk DNS Lookup' \n                'Press Q to Return to the Main Menu' \n                $input1=Read-Host \"Please make a selection\" \n                switch ($input1) \n \n                { \n \n                  1 { Lookup-SingleDNS } \n \n                  2 { Lookup-BulkDNS } \n \n                  Q { Show-Menu }  \n \n                } \n \n                  }  \n            \n           '2' { \n                cls \n                'You have selected option #2' \n \n                'Press 1 for Single Host Entry' \n                'Press 2 for Bulk Host Entries' \n                'Press Q to Return to the Main Menu' \n \n                $input1=Read-Host \"Please make a selection\" \n \n                 switch ($input1) \n \n                { \n \n                  1 { Create-SingleHostEntry } \n \n                  2 { Create-BulkHostEntry } \n \n                  Q { Show-Menu }  \n \n                } \n \n                  } \n            \n            \n            \n           '3'  { \n                cls \n                'You have selected option #3' \n \n                'Press 1 for Single PTR Record' \n                'Press 2 for Bulk PTR Records' \n                'Press Q to Return to the Main Menu' \n \n                $input1=Read-Host \"Please make a selection\" \n \n                 switch ($input1) \n \n                { \n \n                  1 { Create-SinglePTREntry } \n \n                  2 { Create-BulkPTREntry } \n \n                  Q { Show-Menu}  \n \n                } \n \n                  } \n \n \n               '4'  { \n \n                cls \n \n                'You have selected option #4' \n \n                'Press 1 for Single CNAME Record' \n                'Press 2 for Bulk CNAME Records' \n                'Press Q to Return to the Main Menu' \n \n                $input1=Read-Host \"Please make a selection\" \n \n                 switch ($input1) \n \n                { \n \n                  1 { Create-SingleCNAMEEntry } \n \n                  2 { Create-BulkCNAMEEntry } \n \n                  Q { Show-Menu }  \n \n                } \n \n                  } \n \n \n \n                     '5'  { \n \n                cls \n \n                'You have selected option #5' \n \n                'Press 1 to Delete Single Host Record' \n                'Press 2 to Delete multiple Host Records ' \n                'Press Q to Return to the Main Menu' \n \n                $input1=Read-Host \"Please make a selection\" \n \n                 switch ($input1) \n \n                { \n \n                  1 { Delete-SingleHostEntry } \n \n                  2 { Delete-BulkHostEntry } \n \n                  Q { Show-Menu }  \n \n                } \n \n                  } \n \n \n \n                  '6'  { \n \n                cls \n \n                'You have selected option #6' \n \n                'Press 1 to Delete Single PTR Record' \n                'Press 2 to Delete multiple PTR Records ' \n                'Press Q to Return to the Main Menu' \n \n                $input1=Read-Host \"Please make a selection\" \n \n                 switch ($input1) \n \n                { \n \n                  1 { Delete-SinglePTREntry } \n \n                  2 { Delete-BulkPTREntry } \n \n                  Q { Show-Menu}  \n \n                } \n \n                  } \n \n \n \n \n                  '7'  { \n \n                cls \n \n                'You have selected option #7' \n \n                'Press 1 to Delete Single CNAME Record' \n                'Press 2 to Delete multiple CNAME Records ' \n                'Press Q to Return to the Main Menu' \n \n                $input1=Read-Host \"Please make a selection\" \n \n                 switch ($input1) \n \n                { \n \n                  1 { Delete-SingleCNAMEEntry } \n \n                  2 { Delete-BulkCNAMEEntry } \n \n                  Q { Show-Menu }  \n \n                } \n \n                  } \n \n \n                 '8'  { \n \n                cls \n \n                'You have selected option #8' \n \n                'Press 1 to Create a Single Primary DNS Zone' \n                'Press 2 to Create multiple Primary DNS Zones' \n                'Press Q to Return to the Main Menu' \n \n                $input1=Read-Host \"Please make a selection\" \n \n                 switch ($input1) \n \n                { \n \n                  1 { Add-PrimaryDNSZoneEntry } \n \n                  2 { Add-PrimaryBulkDNSZoneEntry } \n \n                  Q { Show-Menu }  \n \n                } \n \n                  } \n\n                 '9'  { \n \n                cls \n \n                'You have selected option #9' \n \n                'Press 1 to Create a Single Secondary DNS Zone' \n                'Press 2 to Create multiple Secondary DNS Zones' \n                'Press Q to Return to the Main Menu' \n \n                $input1=Read-Host \"Please make a selection\" \n \n                 switch ($input1) \n \n                { \n \n                  1 { Add-SecondaryDNSZoneEntry } \n \n                  2 { Add-SecondaryBulkDNSZoneEntry } \n \n                  Q { Show-Menu }  \n \n                } \n \n                  } \n\n                '10'  { \n \n                cls \n \n                'You have selected option #10' \n \n                'Press 1 to Create a Single Stub DNS Zone' \n                'Press 2 to Create multiple Stub DNS Zones' \n                'Press Q to Return to the Main Menu' \n \n                $input1=Read-Host \"Please make a selection\" \n \n                 switch ($input1) \n \n                { \n \n                  1 { Add-StubDNSZoneEntry } \n \n                  2 { Add-StubBulkDNSZoneEntry } \n \n                  Q { Show-Menu }  \n \n                } \n \n                  }\n\n                '11'  { \n \n                cls \n \n                'You have selected option #11' \n \n                'Press 1 to Remove a Single DNS Zone' \n                'Press 2 to Remove multiple DNS Zones' \n                'Press Q to Return to the Main Menu' \n \n                $input1=Read-Host \"Please make a selection\" \n \n                 switch ($input1) \n \n                { \n \n                  1 { Remove-DNSZoneEntry } \n \n                  2 { Remove-BulkDNSZoneEntry } \n \n                  Q { Show-Menu }  \n \n                } \n \n                  }\n\n           \n           'q' { \n                return \n               } \n     } \n     pause \n} \nuntil ($input -eq 'q')<\/pre>\n\n\n\n<p>The DNS Zone functions have not been tested as of yet. I still have to get on my server farm at home and run this. It will save time though with me having to switch servers when adding a bulk list of DNS zones for my website farm. Play with the script and let me know what you think!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was compiling some scripts to be able to modify DNS records in my previous post. While browsing through different scripts in<\/p>\n<p class=\"link-more\"><a class=\"myButt \" href=\"https:\/\/itblog.ldlnet.net\/index.php\/2019\/01\/21\/powerdns-script\/\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":147,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[48,59,2,3,16],"tags":[57,60,8,62,13,61],"class_list":["post-153","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-active-directory","category-dns","category-general","category-powershell","category-windows","tag-dns","tag-function","tag-powershell","tag-records","tag-script","tag-zone","odd"],"_links":{"self":[{"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/posts\/153","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/comments?post=153"}],"version-history":[{"count":1,"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/posts\/153\/revisions"}],"predecessor-version":[{"id":154,"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/posts\/153\/revisions\/154"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/media\/147"}],"wp:attachment":[{"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/media?parent=153"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/categories?post=153"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/tags?post=153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}