Creating DNS PTR records

When I was writing the DNS chapter of PowerShell in Practice I couldn’t get the CreateInstanceFromPropertyData  method on the MicrosoftDNS_PTRType  class to work. Revisiting DNS for AD management in a Month of lunches this time round I have access to the CIM cmdlets so can put the parameter names in.  This gives usage like this.  I’ve shown Invoke-WmiMethod and Invoke-CimMethod so you can see the parameter names:

Invoke-WmiMethod -Namespace root\MicrosoftDNS -Class MicrosoftDNS_PTRType `
-Name CreateInstanceFromPropertyData `
-ArgumentList “”, ‘server02’, ‘’,

Invoke-CimMethod -Namespace root\MicrosoftDNS -ClassName MicrosoftDNS_PTRType `
-MethodName CreateInstanceFromPropertyData `
-Arguments @{Containername = “”;
DnsServerName = ‘server02’; OwnerName = ‘’;
PTRDomainName =”ADMLServer02.admldns.test”}


If you have access to Windows 2012 then you are better off using the cmdlet

Add-DnsServerResourceRecordPtr –Name ‘54’ `
–ZoneName “” `
–PtrDomainName  ‘ADMLServer01.admldns.test’  `
–ComputerName server02


Which ever method you use – you can easily create PTR records

This entry was posted in DNS, PowerShell and WMI, PowerShell V2, PowerShell V3. Bookmark the permalink.

4 Responses to Creating DNS PTR records

  1. Nice! Any chance there is an equivalent command that will work against a BIND DNS server to register a PTR? I know a Windows server has the capability to send DNS update commands to BIND servers because we check off the box “Register this connection’s addresses in DNS” for our AD DC controllers and they update our BIND servers with DNS records. I haven’t found a way for PowerShell to send DNS update commands to a BIND server yet so I’ve resorted to using nsupdate.exe. I posted the question to The reason I’d like this is because I’d like to update DNS when my multi-subnet SQL Server AlwaysOn Availability Group manually fails over from one data center to another. I’ve posted that at


  2. Sagar Dalvi says:

    Thanks Sir !!
    it Works

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s