{"id":17131,"date":"2010-09-13T00:01:00","date_gmt":"2010-09-13T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2010\/09\/13\/manage-dns-in-a-windows-environment-by-using-powershell\/"},"modified":"2010-09-13T00:01:00","modified_gmt":"2010-09-13T00:01:00","slug":"manage-dns-in-a-windows-environment-by-using-powershell","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/manage-dns-in-a-windows-environment-by-using-powershell\/","title":{"rendered":"Manage DNS in a Windows Environment by Using PowerShell"},"content":{"rendered":"<p><b><\/b><\/p>\n<p><b>Summary<\/b>: Manage DNS in a Windows environment by using Windows PowerShell. Guest Blogger Richard Siddaway shows how to do it in a simple and effective manner.<\/p>\n<p>&#160;<\/p>\n<p><img decoding=\"async\" title=\"Hey, Scripting Guy! Question\" border=\"0\" alt=\"Hey, Scripting Guy! Question\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" width=\"34\" height=\"34\" \/> Hey, Scripting Guy! What can I do with Windows PowerShell to manage my DNS infrastructure?<\/p>\n<p>&#8212; RS<\/p>\n<p>&#160;<\/p>\n<p><img decoding=\"async\" title=\"Hey, Scripting Guy! Answer\" border=\"0\" alt=\"Hey, Scripting Guy! Answer\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" width=\"34\" height=\"34\" \/><\/p>\n<p>Hello RS, <\/p>\n<p>Microsoft Scripting Guy Ed Wilson here. I am happy to announce that this is Guest Blogger Week. I love to host these guest bloggers because they give our readers a glimpse into other professionals\u2019 minds and knowledge. Today, we have Richard Siddaway. Richard is a technical architect for Serco in the United Kingdom. He works on transformation projects in the local government and commercial arena. With more than 20 years of experience in various aspects of information technology, Richard specializes in the Microsoft environment at an architectural level, especially around Active Directory, Exchange, SQL Server, and infrastructure optimization. <\/p>\n<p>Richard is always looking for the opportunity to automate a process, preferably with Windows PowerShell. Richard founded and currently leads the UK Windows PowerShell User Group. Microsoft has recognized his technical expertise and community activities by presenting him with a Microsoft Most Valued Professional award. Richard has presented to the Directory Experts Conference, at various events at Microsoft in the UK and Europe, and for other UK User Groups. He has a number of articles and technical publications to his credit, and his first print book has recently been released. The subject? Windows PowerShell, of course.<\/p>\n<p>Blog: <a href=\"http:\/\/msmvps.com\/blogs\/RichardSiddaway\/Default.aspx\">http:\/\/msmvps.com\/blogs\/RichardSiddaway\/Default.aspx<\/a><\/p>\n<p>Book details: <a href=\"http:\/\/www.manning.com\/siddaway\">http:\/\/www.manning.com\/siddaway<\/a><\/p>\n<p>Take it away, Richard\u2026<\/p>\n<p>_______<\/p>\n<p>RS, the short answer to the question about using Windows PowerShell to manage DNS is that you can do anything you want. The longer answer is that you have to work at it a bit. Some areas of working with DNS have already been blogged about by Ed Wilson of the Microsoft Scripting Guys. Here are links to his articles:<\/p>\n<ul>\n<li><a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/2009\/02\/26\/how-do-i-query-and-retrieve-dns-information.aspx\">http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/2009\/02\/26\/how-do-i-query-and-retrieve-dns-information.aspx<\/a> <\/li>\n<li><a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/2009\/02\/25\/how-do-i-create-a-new-dns-zone.aspx\">http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/2009\/02\/25\/how-do-i-create-a-new-dns-zone.aspx<\/a> <\/li>\n<li><a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/2009\/02\/24\/how-can-i-create-dns-mail-exchanger-mx-records-and-have-a-text-file-generated-to-show-what-was-created.aspx\">http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/2009\/02\/24\/how-can-i-create-dns-mail-exchanger-mx-records-and-have-a-text-file-generated-to-show-what-was-created.aspx<\/a> <\/li>\n<li><a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/2009\/02\/23\/how-do-i-check-host-name-records.aspx\">http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/2009\/02\/23\/how-do-i-check-host-name-records.aspx<\/a> <\/li>\n<\/ul>\n<p>Windows PowerShell doesn\u2019t have any way of directly working with DNS. However, there is a great set of WMI classes. They are installed automatically when DNS is installed. At this point, you might be groaning \u201cI don\u2019t like WMI; it\u2019s too hard\u201d. It used to be. Windows PowerShell has brilliant WMI support that makes using it easy and well worth spending a bit of time learning, as you will see.<\/p>\n<p>A new namespace is created for the DNS WMI classes: <b>root\\MicrosoftDNS<\/b>. Because we are using WMI, we can access the DNS server remotely (which makes administration easier). The classes available to work with DNS can be found by using Windows PowerShell:<\/p>\n<blockquote>\n<div class=\"code\"><font color=\"#0000ff\">Get-WmiObject<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-Namespace<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">root\\MicrosoftDNS<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-List<\/font><font color=\"#808080\">&#160;<\/font> <\/div>\n<\/blockquote>\n<p>The DNS classes from a remote DNS server running on a Windows Server 2008 domain controller are shown in the following image.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/2376.HSG09131001_57D9D91A.jpg\"><img decoding=\"async\" style=\"border-bottom: 0px;border-left: 0px;padding-left: 0px;padding-right: 0px;border-top: 0px;border-right: 0px;padding-top: 0px\" title=\"Image of DNS classes from remote DNS server running on Windows Server 2008 domain controller\" border=\"0\" alt=\"Image of DNS classes from remote DNS server running on Windows Server 2008 domain controller\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/5504.HSG09131001_thumb_276354A4.jpg\" width=\"554\" height=\"423\" \/><\/a><\/p>\n<p>In a modern Windows environment, most machines will register their own addresses with DNS (we may need to set reverse lookup\u2014PTR\u2014records through DHCP). There is still a need to create DNS records from time to time, such as if you need to create an alias record. You have a number of WMI classes for working with different DNS record types, which you can see here:<\/p>\n<blockquote>\n<div class=\"code\"><font color=\"#0000ff\">Get-WmiObject<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-Namespace<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">root\\MicrosoftDNS<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-List<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">*<\/font><font color=\"#0000ff\">type<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">|<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#0000ff\">Format-Wide<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-Column<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#800000\">3<\/font><font color=\"#808080\">        <br \/><\/font><font color=\"#000000\">MicrosoftDNS_MGType<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">MicrosoftDNS_X25Type<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">MicrosoftDNS_AFSDBType<\/font><font color=\"#808080\">        <br \/><\/font><font color=\"#000000\">MicrosoftDNS_PTRType<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">MicrosoftDNS_KEYType<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">MicrosoftDNS_SRVType<\/font><font color=\"#808080\">        <br \/><\/font><font color=\"#000000\">MicrosoftDNS_MDType<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">MicrosoftDNS_MBType<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">MicrosoftDNS_AAAAType<\/font><font color=\"#808080\">        <br \/><\/font><font color=\"#000000\">MicrosoftDNS_ISDNType<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">MicrosoftDNS_MINFOType<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">MicrosoftDNS_RPType<\/font><font color=\"#808080\">        <br \/><\/font><font color=\"#000000\">MicrosoftDNS_SIGType<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">MicrosoftDNS_MFType<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">MicrosoftDNS_AType<\/font><font color=\"#808080\">        <br \/><\/font><font color=\"#000000\">MicrosoftDNS_WKSType<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">MicrosoftDNS_WINSRType<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">MicrosoftDNS_SOAType<\/font><font color=\"#808080\">        <br \/><\/font><font color=\"#000000\">MicrosoftDNS_MXType<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">MicrosoftDNS_WINSType<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">MicrosoftDNS_ATMAType<\/font><font color=\"#808080\">        <br \/><\/font><font color=\"#000000\">MicrosoftDNS_NSType<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">MicrosoftDNS_NXTType<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">MicrosoftDNS_RTType<\/font><font color=\"#808080\">        <br \/><\/font><font color=\"#000000\">MicrosoftDNS_CNAMEType<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">MicrosoftDNS_TXTType<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">MicrosoftDNS_HINFOType<\/font><font color=\"#808080\">        <br \/><\/font><font color=\"#000000\">MicrosoftDNS_MRType<\/font> <\/div>\n<\/blockquote>\n<p>I\u2019ve written various scripts in the past to work with individual record types, and I\u2019ve found that each class has slightly different syntax and requirements. This makes life awkward when you want to start automating this process, because you have to have a different script or function for each record type. I decided I wanted a universal script for creating records so that I could create multiple records at the same time from minimal information. The following script shows the function that I came up with to create A, PTR, MX, and CNAME records\u2014these being the most common ones I have to deal with. We will be using the <b>MicrosoftDNS_ResourceRecord<\/b> class with varying inputs. <\/p>\n<blockquote>\n<div class=\"code\"><font color=\"#000000\">function<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">new-dnsrecord<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">{<\/font><font color=\"#808080\">        <br \/><\/font><font color=\"#000000\">param(<\/font><font color=\"#808080\">        <br \/>&#160;&#160;&#160; <\/font><font color=\"#000000\">[string]<\/font><font color=\"#2b91af\">$server<\/font><font color=\"#000000\">,<\/font><font color=\"#808080\">        <br \/>&#160;&#160;&#160; <\/font><font color=\"#000000\">[string]<\/font><font color=\"#2b91af\">$fzone<\/font><font color=\"#000000\">,<\/font><font color=\"#808080\">        <br \/>&#160;&#160;&#160; <\/font><font color=\"#000000\">[string]<\/font><font color=\"#2b91af\">$rzone<\/font><font color=\"#000000\">,<\/font><font color=\"#808080\">        <br \/>&#160;&#160;&#160; <\/font><font color=\"#000000\">[string]<\/font><font color=\"#2b91af\">$computer<\/font><font color=\"#000000\">,<\/font><font color=\"#808080\">        <br \/>&#160;&#160;&#160; <\/font><font color=\"#000000\">[string]<\/font><font color=\"#2b91af\">$address<\/font><font color=\"#000000\">,<\/font><font color=\"#808080\">        <br \/>&#160;&#160;&#160; <\/font><font color=\"#000000\">[string]<\/font><font color=\"#2b91af\">$alias<\/font><font color=\"#000000\">,<\/font><font color=\"#808080\">        <br \/>&#160;&#160;&#160; <\/font><font color=\"#000000\">[string]<\/font><font color=\"#2b91af\">$maildomain<\/font><font color=\"#000000\">,<\/font><font color=\"#808080\">        <br \/>&#160;&#160;&#160; <\/font><font color=\"#000000\">[int]<\/font><font color=\"#2b91af\">$priority<\/font><font color=\"#000000\">,<\/font><font color=\"#808080\">        <br \/>&#160;&#160;&#160; <\/font><font color=\"#000000\">[switch]<\/font><font color=\"#2b91af\">$arec<\/font><font color=\"#000000\">,<\/font><font color=\"#808080\">        <br \/>&#160;&#160;&#160; <\/font><font color=\"#000000\">[switch]<\/font><font color=\"#2b91af\">$ptr<\/font><font color=\"#000000\">,<\/font><font color=\"#808080\">        <br \/>&#160;&#160;&#160; <\/font><font color=\"#000000\">[switch]<\/font><font color=\"#2b91af\">$cname<\/font><font color=\"#000000\">,<\/font><font color=\"#808080\">        <br \/>&#160;&#160;&#160; <\/font><font color=\"#000000\">[switch]<\/font><font color=\"#2b91af\">$mx<\/font><font color=\"#808080\">        <br \/><\/font><font color=\"#000000\">)<\/font><font color=\"#808080\">        <br \/><\/font><font color=\"#0000ff\">##<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">check<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">DNS<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">server<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">contactable<\/font><font color=\"#808080\">        <br \/>&#160;&#160;&#160; <\/font><font color=\"#0000ff\">if<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">(<\/font><font color=\"#0000ff\">-not<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">(Test-Connection<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-ComputerName<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#2b91af\">$server<\/font><font color=\"#000000\">)){Throw<\/font><font color=\"#808080\"> &quot;DNS server not found&quot;<\/font><font color=\"#000000\">}<\/font><font color=\"#808080\">        <br \/><\/font><font color=\"#0000ff\">##<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">split<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">the<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">server<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">fqdn<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">and<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">address<\/font><font color=\"#808080\">        <br \/>&#160;&#160;&#160; <\/font><font color=\"#2b91af\">$srvr<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#0000ff\">=<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#2b91af\">$server<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-split<\/font><font color=\"#808080\"> &quot;\\.&quot;        <br \/>&#160;&#160;&#160; <\/font><font color=\"#2b91af\">$addr<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#0000ff\">=<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#2b91af\">$address<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-split<\/font><font color=\"#808080\"> &quot;\\.&quot;        <\/p>\n<p>&#160;&#160;&#160; <\/font><font color=\"#2b91af\">$rec<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#0000ff\">=<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">[WmiClass]<\/font><font color=\"#808080\">&quot;\\\\$($srvr[0])\\root\\MicrosoftDNS:MicrosoftDNS_ResourceRecord&quot;&#160; <br \/><\/font><font color=\"#0000ff\">##<\/font><font color=\"#808080\">        <br \/><\/font><font color=\"#0000ff\">##<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">create<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">records<\/font><font color=\"#808080\">        <br \/><\/font><font color=\"#0000ff\">##<\/font><font color=\"#808080\">&#160; <br \/><\/font><font color=\"#0000ff\">##<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">A<\/font><font color=\"#808080\">        <br \/>&#160;&#160;&#160; <\/font><font color=\"#0000ff\">if<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">(<\/font><font color=\"#2b91af\">$arec<\/font><font color=\"#000000\">){<\/font><font color=\"#808080\">        <br \/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <\/font><font color=\"#2b91af\">$text<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#0000ff\">=<\/font><font color=\"#808080\"> &quot;$computer IN A $address&quot;&#160; <br \/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <\/font><font color=\"#2b91af\">$rec<\/font><font color=\"#000000\">.CreateInstanceFromTextRepresentation(<\/font><font color=\"#2b91af\">$server<\/font><font color=\"#000000\">,<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#2b91af\">$fzone<\/font><font color=\"#000000\">,<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#2b91af\">$text<\/font><font color=\"#000000\">)<\/font><font color=\"#808080\">&#160; <br \/>&#160;&#160;&#160; <\/font><font color=\"#000000\">}<\/font><font color=\"#808080\">        <br \/><\/font><font color=\"#0000ff\">##<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">CNAME<\/font><font color=\"#808080\">        <br \/>&#160;&#160;&#160; <\/font><font color=\"#0000ff\">if<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">(<\/font><font color=\"#2b91af\">$cname<\/font><font color=\"#000000\">){<\/font><font color=\"#808080\">        <br \/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <\/font><font color=\"#2b91af\">$text<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#0000ff\">=<\/font><font color=\"#808080\"> &quot;$alias IN CNAME $computer&quot;&#160; <br \/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <\/font><font color=\"#2b91af\">$rec<\/font><font color=\"#000000\">.CreateInstanceFromTextRepresentation(<\/font><font color=\"#2b91af\">$server<\/font><font color=\"#000000\">,<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#2b91af\">$fzone<\/font><font color=\"#000000\">,<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#2b91af\">$text<\/font><font color=\"#000000\">)<\/font><font color=\"#808080\">&#160; <br \/>&#160;&#160;&#160; <\/font><font color=\"#000000\">}<\/font><font color=\"#808080\">        <br \/><\/font><font color=\"#0000ff\">##<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">PTR<\/font><font color=\"#808080\">        <br \/>&#160;&#160;&#160; <\/font><font color=\"#0000ff\">if<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">(<\/font><font color=\"#2b91af\">$ptr<\/font><font color=\"#000000\">){<\/font><font color=\"#808080\">        <br \/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <\/font><font color=\"#2b91af\">$text<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#0000ff\">=<\/font><font color=\"#808080\"> &quot;$($addr[3]).$rzone IN PTR $computer&quot;&#160; <br \/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <\/font><font color=\"#2b91af\">$rec<\/font><font color=\"#000000\">.CreateInstanceFromTextRepresentation(<\/font><font color=\"#2b91af\">$server<\/font><font color=\"#000000\">,<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#2b91af\">$rzone<\/font><font color=\"#000000\">,<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#2b91af\">$text<\/font><font color=\"#000000\">)<\/font><font color=\"#808080\">&#160; <br \/>&#160;&#160;&#160; <\/font><font color=\"#000000\">}<\/font><font color=\"#808080\">        <br \/><\/font><font color=\"#0000ff\">##<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">MX<\/font><font color=\"#808080\">        <br \/>&#160;&#160;&#160; <\/font><font color=\"#0000ff\">if<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">(<\/font><font color=\"#2b91af\">$mx<\/font><font color=\"#000000\">){<\/font><font color=\"#808080\">        <br \/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <\/font><font color=\"#2b91af\">$text<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#0000ff\">=<\/font><font color=\"#808080\"> &quot;$maildomain IN MX $priority $computer&quot;&#160; <br \/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <\/font><font color=\"#2b91af\">$rec<\/font><font color=\"#000000\">.CreateInstanceFromTextRepresentation(<\/font><font color=\"#2b91af\">$server<\/font><font color=\"#000000\">,<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#2b91af\">$fzone<\/font><font color=\"#000000\">,<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#2b91af\">$text<\/font><font color=\"#000000\">)<\/font><font color=\"#808080\">&#160; <br \/>&#160;&#160;&#160; <\/font><font color=\"#000000\">}<\/font><font color=\"#808080\">        <br \/><\/font><font color=\"#000000\">}<\/font> <\/div>\n<\/blockquote>\n<p>The script was written using Windows PowerShell 2.0, but it is usable in Windows PowerShell1.0 with suitable modifications as detailed in the text. The first change is in the section where we test the connectivity to the DNS server (the <b>Test-Connection<\/b> cmdlet was introduced in version 2.0 of Windows PowerShell). We can overcome this problem by replacing that line with this one: <\/p>\n<blockquote>\n<div class=\"code\"><font color=\"#0000ff\">if<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">((<\/font><font color=\"#0000ff\">Get-WmiObject<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-Query<\/font><font color=\"#808080\"> &quot;Select * from Win32_PingStatus WHERE Address = &#8216;$server&#8217;&quot;<\/font><font color=\"#000000\">).StatusCode<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#0000ff\">-ne<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#800000\">0<\/font><font color=\"#000000\">){Throw<\/font><font color=\"#808080\"> &quot;DNS server not found&quot;<\/font><font color=\"#000000\">}<\/font> <\/div>\n<\/blockquote>\n<p>More information about using <b>Win32_PingStatus<\/b> can be found on MSDN at <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/aa394350(VS.85).aspx#1\">http:\/\/msdn.microsoft.com\/en-us\/library\/aa394350(VS.85).aspx#1<\/a><\/p>\n<p>OK, let\u2019s pick this function apart. I start out by defining a bunch of parameters. I haven\u2019t used any of the advanced function capabilities here so as to ensure maximum usability of the script. A deliberate decision was made to avoid using parameter sets because this would cause additional complexity when I wanted to create multiple records. The parameters are as follows:<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"85\">\n<p><b>Parameter<\/b><\/p>\n<\/td>\n<td valign=\"top\" width=\"75\">\n<p><b>Type<\/b><\/p>\n<\/td>\n<td valign=\"top\" width=\"425\">\n<p><b>Meaning <\/b><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"85\">\n<p>$server <\/p>\n<\/td>\n<td valign=\"top\" width=\"75\">\n<p>String<\/p>\n<\/td>\n<td valign=\"top\" width=\"425\">\n<p>DNS Server FQDN<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"85\">\n<p>$fzone <\/p>\n<\/td>\n<td valign=\"top\" width=\"75\">\n<p>String<\/p>\n<\/td>\n<td valign=\"top\" width=\"425\">\n<p>Forward lookup zone<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"85\">\n<p>$rzone <\/p>\n<\/td>\n<td valign=\"top\" width=\"75\">\n<p>String<\/p>\n<\/td>\n<td valign=\"top\" width=\"425\">\n<p>Reverse lookup zone<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"85\">\n<p>$computer <\/p>\n<\/td>\n<td valign=\"top\" width=\"75\">\n<p>String<\/p>\n<\/td>\n<td valign=\"top\" width=\"425\">\n<p>Computer FQDN for which we are creating DNS entry<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"85\">\n<p>$address <\/p>\n<\/td>\n<td valign=\"top\" width=\"75\">\n<p>String<\/p>\n<\/td>\n<td valign=\"top\" width=\"425\">\n<p>Address of the computer<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"85\">\n<p>$alias <\/p>\n<\/td>\n<td valign=\"top\" width=\"75\">\n<p>String<\/p>\n<\/td>\n<td valign=\"top\" width=\"425\">\n<p>Alias of the computer<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"85\">\n<p>$maildomain <\/p>\n<\/td>\n<td valign=\"top\" width=\"75\">\n<p>String<\/p>\n<\/td>\n<td valign=\"top\" width=\"425\">\n<p>Mail domain<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"85\">\n<p>$priority <\/p>\n<\/td>\n<td valign=\"top\" width=\"75\">\n<p>Int<\/p>\n<\/td>\n<td valign=\"top\" width=\"425\">\n<p>Mail priority<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"85\">\n<p>$arec <\/p>\n<\/td>\n<td valign=\"top\" width=\"75\">\n<p>Switch<\/p>\n<\/td>\n<td valign=\"top\" width=\"425\">\n<p>Create A record<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"85\">\n<p>$ptr <\/p>\n<\/td>\n<td valign=\"top\" width=\"75\">\n<p>Switch<\/p>\n<\/td>\n<td valign=\"top\" width=\"425\">\n<p>Create PTR record<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"85\">\n<p>$cname <\/p>\n<\/td>\n<td valign=\"top\" width=\"75\">\n<p>Switch<\/p>\n<\/td>\n<td valign=\"top\" width=\"425\">\n<p>Create Alias record<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"85\">\n<p>$mx<\/p>\n<\/td>\n<td valign=\"top\" width=\"75\">\n<p>Switch<\/p>\n<\/td>\n<td valign=\"top\" width=\"425\">\n<p>Create MX (mail server) record<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>I haven\u2019t defined any defaults for the parameters. After the parameter definitions, you can check whether the DNS server is contactable as mentioned earlier. It is possible to test if the DNS service was actually running by using one or the other of these <b>Get<\/b> commands:<\/p>\n<blockquote>\n<div class=\"code\"><font color=\"#0000ff\">Get-Service<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">(Windows<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">PowerShell<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#800000\">2<\/font><font color=\"#000000\">.<\/font><font color=\"#800000\">0<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">has<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">a<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">computername<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">parameter)<\/font><font color=\"#808080\">&#160; <\/p>\n<p><\/font><font color=\"#0000ff\">Get-Service<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-Name<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">DNS<\/font> <\/div>\n<\/blockquote>\n<p>WMI (<b>computername<\/b> parameter in Windows PowerShell versions 2.0 and 1.0)<\/p>\n<blockquote>\n<div class=\"code\"><font color=\"#0000ff\">Get-WmiObject<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-Class<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">Win32_Service<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-Filter<\/font><font color=\"#808080\"> &quot;Name = &#8216;DNS&#8217;&quot;<\/font> <\/div>\n<\/blockquote>\n<p>The next task is to split the server and address into their separate parts. They both have a period (\u201c.\u201d) as the separator. Using the <b>\u2013split <\/b>operator, you need to escape the dot using the back slash (\u201c\\\u201d) character. An alternative, which will work in PowerShell 1.0 as well, is to use the <b>Split()<\/b> method of the <b>string<\/b> class:<\/p>\n<blockquote>\n<div class=\"code\"><font color=\"#2b91af\">$server<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#0000ff\">=<\/font><font color=\"#808080\"> &quot;server02.manticore.org&quot;        <br \/><\/font><font color=\"#2b91af\">$address<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#0000ff\">=<\/font><font color=\"#808080\"> &quot;10.10.54.27&quot;        <br \/><\/font><font color=\"#2b91af\">$srvr<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#0000ff\">=<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#2b91af\">$server<\/font><font color=\"#000000\">.Split(<\/font><font color=\"#808080\">&quot;.&quot;<\/font><font color=\"#000000\">)<\/font><font color=\"#808080\">        <br \/><\/font><font color=\"#2b91af\">$addr<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#0000ff\">=<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#2b91af\">$address<\/font><font color=\"#000000\">.Split(<\/font><font color=\"#808080\">&quot;.&quot;<\/font><font color=\"#000000\">)<\/font> <\/div>\n<\/blockquote>\n<p>In this case, you don\u2019t need the escape character.<\/p>\n<p>The final preparatory step is to create an instance of the <b>MicrosoftDNS_ResourceRecord<\/b> class using the <b>[wmiclass]<\/b> type accelerator. A type accelerator is used as a shortcut to a .NET Framework class. In this case, we create an instance of the <b>System.Management.ManagementClass<\/b>. In other words, you are creating a WMI class. When you use <b>Get-WmiObject<\/b>, you are getting an instance of an existing class, and Windows PowerShell returns an object from the <b>System.Management.ManagementObject<\/b> class:<\/p>\n<blockquote>\n<div class=\"code\"><font color=\"#2b91af\">$rec<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#0000ff\">=<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">[WmiClass]\\\\server02\\root\\MicrosoftDNS:MicrosoftDNS_ResourceRecord<\/font><font color=\"#808080\">        <\/p>\n<p><\/font><font color=\"#2b91af\">$rec<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">|<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#0000ff\">gm<\/font> <\/div>\n<\/blockquote>\n<p>Using <b>gm<\/b> (an alias for <b>Get-Member<\/b>), we can view the class of object we have created:<\/p>\n<blockquote>\n<div class=\"code\"><font color=\"#000000\">TypeName:<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">System.Management.ManagementClass<\/font><font color=\"#0000ff\">#<\/font><font color=\"#000000\">ROOT\\MicrosoftDNS\\MicrosoftDNS_ResourceRecord<\/font> <\/div>\n<\/blockquote>\n<p>You can also determine the methods that are available to this class:<\/p>\n<blockquote>\n<div class=\"code\"><font color=\"#000000\">CreateInstanceFromTextRepresentation<\/font><font color=\"#808080\">        <\/p>\n<p><\/font><font color=\"#000000\">GetObjectByTextRepresentation<\/font> <\/div>\n<\/blockquote>\n<p>You can use <b>CreateInstanceFromTextRepresentation<\/b>, which must be one of the longest method names I\u2019ve come across. It\u2019s not something I want to type on a regular basis, and at moments like this, I\u2019m extremely grateful to the inventors of cut and paste.<\/p>\n<p>The last step in the script is to create the DNS records:<\/p>\n<blockquote>\n<div class=\"code\"><font color=\"#808080\">&#160;&#160;&#160; <\/font><font color=\"#0000ff\">if<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">(<\/font><font color=\"#2b91af\">$arec<\/font><font color=\"#000000\">){<\/font><font color=\"#808080\">        <\/p>\n<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <\/font><font color=\"#2b91af\">$text<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#0000ff\">=<\/font><font color=\"#808080\"> &quot;$computer IN A $address&quot;&#160; <\/p>\n<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <\/font><font color=\"#2b91af\">$rec<\/font><font color=\"#000000\">.CreateInstanceFromTextRepresentation(<\/font><font color=\"#2b91af\">$server<\/font><font color=\"#000000\">,<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#2b91af\">$fzone<\/font><font color=\"#000000\">,<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#2b91af\">$text<\/font><font color=\"#000000\">)<\/font><font color=\"#808080\">&#160; <\/p>\n<p>&#160;&#160;&#160; <\/font><font color=\"#000000\">}<\/font> <\/div>\n<\/blockquote>\n<p>Now test to see if the switch for that record type is set (remember that switch parameters default to false so you can just ignore them if you don\u2019t need to create a record of a particular type). If it is set, you create the appropriate text for the record and call the <b>CreateInstanceFromTextRepresentation<\/b> method, which takes three parameters:<\/p>\n<ul>\n<li>DNS server<\/li>\n<li>DNS zone<\/li>\n<li>Text representation of DNS record.<\/li>\n<\/ul>\n<p>Let\u2019s create some records. There are a number of common parameters:<\/p>\n<ul>\n<li>Server name<\/li>\n<li>Computer name (host which new record points to) and its address<\/li>\n<li>A zone, usually the forward lookup zone.<\/li>\n<\/ul>\n<h4>&#160;<\/h4>\n<h4>A record<\/h4>\n<p>The only additional parameter is the switch to tell the script to create an A record:<\/p>\n<blockquote>\n<div class=\"code\"><font color=\"#000000\">new-dnsrecord<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-server<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">server02<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-fzone<\/font><font color=\"#808080\"> &#8216;manticore.org&#8217; <\/font><font color=\"#000000\">`<\/font><font color=\"#808080\">        <\/p>\n<p><\/font><font color=\"#00\n0000\">-computer<\/font><font color=\"#808080\"> &#8216;test27.manticore.org&#8217; <\/font><font color=\"#000000\">-address<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#800000\">10<\/font><font color=\"#000000\">.<\/font><font color=\"#800000\">10<\/font><font color=\"#000000\">.<\/font><font color=\"#800000\">54<\/font><font color=\"#000000\">.<\/font><font color=\"#800000\">241<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-arec<\/font> <\/div>\n<\/blockquote>\n<h4>PTR Record<\/h4>\n<p>The reverse lookup zone needs to be supplied as well as the <b>\u2013prt<\/b> switch:<\/p>\n<blockquote>\n<div class=\"code\"><font color=\"#000000\">new-dnsrecord<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-server<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">server02<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-rzone<\/font><font color=\"#808080\"> &#8216;54.10.10.in-addr.arpa&#8217; <\/font><font color=\"#000000\">`<\/font><font color=\"#808080\">        <\/p>\n<p><\/font><font color=\"#000000\">-computer<\/font><font color=\"#808080\"> &#8216;test27.manticore.org&#8217; <\/font><font color=\"#000000\">-address<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#800000\">10<\/font><font color=\"#000000\">.<\/font><font color=\"#800000\">10<\/font><font color=\"#000000\">.<\/font><font color=\"#800000\">54<\/font><font color=\"#000000\">.<\/font><font color=\"#800000\">241<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-ptr<\/font> <\/div>\n<\/blockquote>\n<h4>Alias Record<\/h4>\n<p>This adds the <b>-alias<\/b> parameter and uses the <b>\u2013cname<\/b> switch rather than the <b>\u2013arec<\/b> switch that we saw with the A record:<\/p>\n<blockquote>\n<div class=\"code\"><font color=\"#000000\">new-dnsrecord<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-server<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">server02<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-fzone<\/font><font color=\"#808080\"> &#8216;manticore.org&#8217; <\/font><font color=\"#000000\">-computer<\/font><font color=\"#808080\"> &#8216;test27.manticore.org&#8217; <\/font><font color=\"#000000\">`<\/font><font color=\"#808080\">        <\/p>\n<p><\/font><font color=\"#000000\">-alias<\/font><font color=\"#808080\"> &#8216;mydnstest.manticore.org&#8217; <\/font><font color=\"#000000\">-cname<\/font> <\/div>\n<\/blockquote>\n<h4>MX record<\/h4>\n<p>This one is a bit different in that you add the mail domain along with a priority. The priority dictates which mail server is used; the lowest priority value wins. The example is completed by using an <b>\u2013mx<\/b> switch:<\/p>\n<blockquote>\n<div class=\"code\"><font color=\"#000000\">new-dnsrecord<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-server<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">server02<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-fzone<\/font><font color=\"#808080\"> &#8216;manticore.org&#8217; <\/font><font color=\"#000000\">-computer<\/font><font color=\"#808080\"> &#8216;test27.manticore.org&#8217; <\/font><font color=\"#000000\">`<\/font><font color=\"#808080\">        <\/p>\n<p><\/font><font color=\"#000000\">-maildomain<\/font><font color=\"#808080\"> &#8216;manticore.org&#8217; <\/font><font color=\"#000000\">-priority<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#800000\">10<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-mx<\/font> <\/div>\n<\/blockquote>\n<h4>Multiple records<\/h4>\n<p>You can put several of the previous examples together to use this function to create a number of records at the same time:<\/p>\n<blockquote>\n<div class=\"code\"><font color=\"#000000\">new-dnsrecord<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-server<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">server02<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-fzone<\/font><font color=\"#808080\"> &#8216;manticore.org&#8217; <\/font><font color=\"#000000\">-rzone<\/font><font color=\"#808080\"> &#8216;54.10.10.in-addr.arpa&#8217; <\/font><font color=\"#000000\">`<\/font><font color=\"#808080\">        <\/p>\n<p><\/font><font color=\"#000000\">-computer<\/font><font color=\"#808080\"> &#8216;test27.manticore.org&#8217; <\/font><font color=\"#000000\">-address<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#800000\">10<\/font><font color=\"#000000\">.<\/font><font color=\"#800000\">10<\/font><font color=\"#000000\">.<\/font><font color=\"#800000\">54<\/font><font color=\"#000000\">.<\/font><font color=\"#800000\">241<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-alias<\/font><font color=\"#808080\"> &#8216;mydnstest.manticore.org&#8217; <\/font><font color=\"#000000\">`<\/font><font color=\"#808080\">        <\/p>\n<p><\/font><font color=\"#000000\">-arec<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-cname<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-ptr<\/font> <\/div>\n<\/blockquote>\n<p>This example creates an A record, a PTR record, and an alias, all in one pass. You have to supply the reverse lookup zone, although that could be calculated from the <b>address<\/b> parameter if required, as well as the alias.<\/p>\n<p>The function can be easily extended if other record types are required. If your environment has a single forward zone and a single reverse zone, it would be possible to set those values as defaults for the relevant parameters. This would save some typing and make the script easier to use.<\/p>\n<p>It is also possible to use this script for the bulk creation of DNS records. Put the data in a CSV file and pipe the contents into <b>foreach<\/b> with the function call within the <b>foreach<\/b>. <\/p>\n<p>As well as showing how to use the DNS WMI classes, this script has a number of useful techniques that can be used in other places.<\/p>\n<p>Further information about using Windows PowerShell to administer DNS can be found in chapter 9 of <a href=\"http:\/\/www.manning.com\/siddaway\/\">PowerShell in Practice<\/a> and in <a href=\"http:\/\/msmvps.com\/blogs\/richardsiddaway\/archive\/2010\/06\/29\/powershell-ug-june-meeting-slides-and-recording.aspx\">a recording of a PowerShell User Group meeting<\/a>.<\/p>\n<p>&#160;<\/p>\n<p>RS, that is all there is to using Windows PowerShell to work with DNS. And thank you, Richard, for writing such an informative post. Guest Blogger Week will continue tomorrow when we will talk about SharePoint with Josh Gavant as our guest.<\/p>\n<p>We would love for you to follow us on <a href=\"http:\/\/bit.ly\/scriptingguystwitter\">Twitter<\/a> and <a href=\"http:\/\/bit.ly\/scriptingguysfacebook\">Facebook<\/a>. If you have any questions, send email to us at <a href=\"mailto:scripter@microsoft.com\">scripter@microsoft.com<\/a>, or post your questions on the <a href=\"http:\/\/bit.ly\/scriptingforum\">Official Scripting Guys Forum<\/a>. See you tomorrow. Until then, peace.<\/p>\n<p>&#160;<\/p>\n<p><b>Ed Wilson and Craig Liebendorfer, Scripting Guys<\/b><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Manage DNS in a Windows environment by using Windows PowerShell. Guest Blogger Richard Siddaway shows how to do it in a simple and effective manner. &#160; Hey, Scripting Guy! What can I do with Windows PowerShell to manage my DNS infrastructure? &#8212; RS &#160; Hello RS, Microsoft Scripting Guy Ed Wilson here. I am [&hellip;]<\/p>\n","protected":false},"author":595,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[188,56,37,189,3,45],"class_list":["post-17131","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-dns-server","tag-guest-blogger","tag-networking","tag-richard-siddaway","tag-scripting-guy","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Summary: Manage DNS in a Windows environment by using Windows PowerShell. Guest Blogger Richard Siddaway shows how to do it in a simple and effective manner. &#160; Hey, Scripting Guy! What can I do with Windows PowerShell to manage my DNS infrastructure? &#8212; RS &#160; Hello RS, Microsoft Scripting Guy Ed Wilson here. I am [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/17131","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/595"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=17131"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/17131\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=17131"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=17131"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=17131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}