Hi all,
I am trying to writ a script that will look at a DNS server, identify all the Zones, see if Dynamic Update is set to “NonsecureandSecure”, and if any zone are not set to that set it.
This is what I have come up with:
Begin Script*
#Script to identify all zones on a DNS server and enable zone transfers Start-Transcript .\ZoneTransferInfo.txt Get-DNSServerZone |ft -Property ZoneName, ZoneType, DynamicUpdate Get-DNSServerZone | where DynamicUpdate -eq 'None' |ft -Property ZoneName, ZoneType, DynamicUpdate $NoDynamicUpdate = Get-DNSServerZone | where DynamicUpdate -eq 'None' | FT ZoneName foreach ($item in $NoDynamicUpdate) {Set-DNSServerPrimaryZone -Name "$item" -DynamicUpdate "NonsecureandSecure" -PassThru} Get-DNSServerZone |ft -Property ZoneName, ZoneType, DynamicUpdate Stop-Transcript
End Script
I am getting a few errors that I am having trouble working through. When I run the foreach line I get the following error:
Set-DNSServerPrimaryZone : The zone Microsoft.PowerShell.Commands.Internal.Format.FormatEndData was not found on
server LAB-DC02.
At line:2 char:2
- {Set-DNSServerPrimaryZone -Name “$item” -DynamicUpdate “NonsecureandSecure”
-Pas … -
+ CategoryInfo : ObjectNotFound: (Microsoft.Power...t.FormatEndDa
ta:root/Microsoft/...rverPrimaryZone) [Set-DnsServerPrimaryZone], CimExcep
tion
+ FullyQualifiedErrorId : WIN32 9601,Set-DnsServerPrimaryZone
Any help/suggestion is greatly appreciated.