PowerTip: Create an SRV Record in DNS with PowerShell

PowerTip: Create an SRV Record in DNS with PowerShell

  • Comments 7
  • Likes

Summary: Use Windows PowerShell cmdlets to create a server resource record.

Hey, Scripting Guy! Question Is there was a way to script the creation of my internal server resource records for my Lync deployments?

Hey, Scripting Guy! Answer If you're running Windows Server 2012 R2 or Windows Server 2012,
          use the Add-NewDNSServerResourceRecord cmdlet (the following is a one-line command
          that is broken for the webpage):

Add-DnsServerResourceRecord –zone Contoso.local –name _sip
–domainname sip.contoso.local –weight 0 –priority 0 –port 5060 –computername Contoso-DC

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • VERY HANDY! I'll keep this one in my Lync scripting toolbox, thanks!

  • @Anthony

    Glad to be of assistance. I think I got the Port number wrong but it's one of the best additions to the Cmdlet lineup from Microsoft. I've been itching to have this for years :)


  • Thanks for bringing attention to the DNS cmdlets! Maybe we'll get a multi-line TXT record feature in the next release. 😊

  • thank you

  • Brilliant, very brilliant!!!

  • how about give protocol option for SRV Records?

  • @Joshua Solution for protocol parameter, example:
    Add-dnsserverresourcerecord -srv -zonename cybex.net -domainname dc01.cybex.net -name _http._tcp -port 80 -priority 10 -weight 0