Creating DNS PTR-records with powershell

To create a PTR-record with powershell IP-address must be rewritten back to front and a reverse lookup zone must be specified. In big infrastructures may exist several overlapped zones.

dnsptr.ps1
 
 
 
 
 
5 Star
(3)
486 times
Add to favorites
Networking
8/4/2018
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • The term 'Get-DnsServerZone' is not recognized as the name of a cmdlet
    1 Posts | Last post July 15, 2019
    • Hi,
      I try to run this script and i get ERROR : 
      
      PS C:\Users\moshe> C:\Users\moshe\Downloads\dnsptr.ps1
      Import-Module : The specified module 'DnsServer' was not loaded because no valid module file was found in any module directory.
      At C:\Users\moshe\Downloads\dnsptr.ps1:1 char:1
      + Import-Module DnsServer
      + ~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : ResourceUnavailable: (DnsServer:String) [Import-Module], FileNotFoundException
          + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
       
      Please enter resource name: test1
      Please enter IP-address: 192.168.1.12
      Get-DnsServerZone : The term 'Get-DnsServerZone' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, 
      or if a path was included, verify that the path is correct and try again.
      At C:\Users\moshe\Downloads\dnsptr.ps1:12 char:18
      + $reverseZones = (Get-DnsServerZone -ComputerName $dnsserver | Where { ...
      +                  ~~~~~~~~~~~~~~~~~
          + CategoryInfo          : ObjectNotFound: (Get-DnsServerZone:String) [], CommandNotFoundException
          + FullyQualifiedErrorId : CommandNotFoundException
       
      Get-DnsServerResourceRecord : The term 'Get-DnsServerResourceRecord' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the 
      spelling of the name, or if a path was included, verify that the path is correct and try again.
      At C:\Users\moshe\Downloads\dnsptr.ps1:15 char:34
      + $ExistingPtr = $reverseZones | %{Get-DnsServerResourceRecord -ZoneNam ...
      +                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : ObjectNotFound: (Get-DnsServerResourceRecord:String) [], CommandNotFoundException
          + FullyQualifiedErrorId : CommandNotFoundException