<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.technet.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Manage DNS in a Windows Environment by Using PowerShell</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2010/09/13/manage-dns-in-a-windows-environment-by-using-powershell.aspx</link><description>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. &amp;#160; Hey, Scripting Guy! What can I do with Windows PowerShell to manage my DNS infrastructure</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Manage DNS in a Windows Environment by Using PowerShell</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2010/09/13/manage-dns-in-a-windows-environment-by-using-powershell.aspx#3497557</link><pubDate>Fri, 11 May 2012 20:49:51 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3497557</guid><dc:creator>Greg</dc:creator><description>&lt;p&gt;Microsoft has an unreleased software utility called &amp;quot;DNS_Exporter_Application_V1.2&amp;quot; that does a great job of exporting and importing DNS entries, with user-supplied parameters like days to allow for &amp;quot;stale&amp;quot; calculations. Unfortunately, the tool is old and doesn&amp;#39;t provide any command-line parameters so it can&amp;#39;t be automated.&lt;/p&gt;
&lt;p&gt;It supplies the following (info or examples in brackets)&lt;/p&gt;
&lt;p&gt;﻿﻿﻿﻿Record Type ﻿(ie. &amp;quot;MicrosoftDNS_AType&amp;quot;)&lt;/p&gt;
&lt;p&gt;ContainerName (domain.name) &lt;/p&gt;
&lt;p&gt;DnsServerName (server name) &lt;/p&gt;
&lt;p&gt;DomainName (domain.name)&lt;/p&gt;
&lt;p&gt;OwnerName (what registered it)&lt;/p&gt;
&lt;p&gt;RecordData (IP address)&lt;/p&gt;
&lt;p&gt;TextRepresentation (record data)&lt;/p&gt;
&lt;p&gt;TimeStamp (epoch time)&lt;/p&gt;
&lt;p&gt;TimeStamp (Friendly) (human readable time)&lt;/p&gt;
&lt;p&gt;Static (T/F)&lt;/p&gt;
&lt;p&gt;Stale (T/F)&lt;/p&gt;
&lt;p&gt;TTL (time to live in seconds)&lt;/p&gt;
&lt;p&gt;I have yet to find a way to emulate this with a Powershell query. Any suggestions? I&amp;#39;ve tried the user-supplied &amp;quot;DNSShell&amp;quot; module, but it doesn&amp;#39;t have this functionality either. Thanks!&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3497557" width="1" height="1"&gt;</description></item><item><title>re: Manage DNS in a Windows Environment by Using PowerShell</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2010/09/13/manage-dns-in-a-windows-environment-by-using-powershell.aspx#3430924</link><pubDate>Mon, 23 May 2011 00:11:13 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3430924</guid><dc:creator>Kayser Soze</dc:creator><description>&lt;p&gt;I get &amp;quot;Access Denied&amp;quot; when using WMI with DNS on powershell. The DNS server is on a DC and since we don&amp;#39;t want to run the script as a Domain Admin, WMI access is not allowed. How do you make this work so that only the required access to WMI is granted for the user to run the script against a DNS/DC?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3430924" width="1" height="1"&gt;</description></item><item><title>re: Manage DNS in a Windows Environment by Using PowerShell</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2010/09/13/manage-dns-in-a-windows-environment-by-using-powershell.aspx#3414591</link><pubDate>Mon, 21 Mar 2011 18:53:01 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3414591</guid><dc:creator>Matt</dc:creator><description>&lt;p&gt;I get the following error when trying to run the function:&lt;/p&gt;
&lt;p&gt;Exception calling &amp;quot;CreateInstanceFromTextRepresentation&amp;quot; : &amp;quot;Generic failure &amp;quot;&lt;/p&gt;
&lt;p&gt;At D:\Admin\ps\mwiest\DNS_RecordAdd.ps1:29 char:50&lt;/p&gt;
&lt;p&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $rec.CreateInstanceFromTextRepresentation &amp;lt;&amp;lt;&amp;lt;&amp;lt; ($server, $fzone, $text) &amp;nbsp;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;+ CategoryInfo &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: NotSpecified: (:) [], MethodInvocationException&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;+ FullyQualifiedErrorId : WMIMethodException&lt;/p&gt;
&lt;p&gt;Any ideas why?&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3414591" width="1" height="1"&gt;</description></item><item><title>re: Manage DNS in a Windows Environment by Using PowerShell</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2010/09/13/manage-dns-in-a-windows-environment-by-using-powershell.aspx#3376636</link><pubDate>Tue, 21 Dec 2010 18:42:04 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3376636</guid><dc:creator>Richard.Siddaway</dc:creator><description>&lt;p&gt;Hi Laurence&lt;/p&gt;
&lt;p&gt;Thanks for the question. &amp;nbsp;The function in the post essentially does this.&lt;/p&gt;
&lt;p&gt;$server = &amp;quot;server02&amp;quot;&lt;/p&gt;
&lt;p&gt;$fzone = &amp;#39;manticore.org&amp;#39;&lt;/p&gt;
&lt;p&gt;$text = &amp;quot;test27.manticore.org IN A 10.10.54.241&amp;quot;&lt;/p&gt;
&lt;p&gt;$rec = [WmiClass]&amp;quot;\\$server\root\MicrosoftDNS:MicrosoftDNS_ResourceRecord&amp;quot; &lt;/p&gt;
&lt;p&gt;$rec.CreateInstanceFromTextRepresentation($server, $fzone, $text)&lt;/p&gt;
&lt;p&gt;You are correct in that the documentation does show four arguments. The fourth is the output from the completion of the method. It isn&amp;#39;t needed for the method to work. In fact if you try&lt;/p&gt;
&lt;p&gt;$rec.CreateInstanceFromTextRepresentation($server, $fzone, $text, $rout)&lt;/p&gt;
&lt;p&gt;You will get an error that states&lt;/p&gt;
&lt;p&gt;Cannot find an overload for &amp;quot;CreateInstanceFromTextRepresentation&amp;quot; and the argument count: &amp;quot;4&amp;quot;.&lt;/p&gt;
&lt;p&gt;We can see how to use the output in this script&lt;/p&gt;
&lt;p&gt;$server = &amp;quot;server02&amp;quot;&lt;/p&gt;
&lt;p&gt;$fzone = &amp;#39;manticore.org&amp;#39;&lt;/p&gt;
&lt;p&gt;$text = &amp;quot;test27.manticore.org IN A 10.10.54.241&amp;quot;&lt;/p&gt;
&lt;p&gt;$rec = [WmiClass]&amp;quot;\\$server\root\MicrosoftDNS:MicrosoftDNS_ResourceRecord&amp;quot; &lt;/p&gt;
&lt;p&gt;$rr = $rec.CreateInstanceFromTextRepresentation($server, $fzone, $text)&lt;/p&gt;
&lt;p&gt;$rr.RR -split &amp;quot;,&amp;quot;&lt;/p&gt;
&lt;p&gt;We put the output into a variable and then take the RR property (a list divided by commas) and split it to make it readable. &amp;nbsp;We get soemthing like this back&lt;/p&gt;
&lt;p&gt;MicrosoftDNS_AType.RecordData=&amp;quot;10.10.54.241&amp;quot;&lt;/p&gt;
&lt;p&gt;RecordClass=1&lt;/p&gt;
&lt;p&gt;DnsServerName=&amp;quot;SERVER02.Manticore.org&amp;quot;&lt;/p&gt;
&lt;p&gt;ContainerName=&amp;quot;manticore.org&amp;quot;&lt;/p&gt;
&lt;p&gt;DomainName=&amp;quot;manticore.org&amp;quot;&lt;/p&gt;
&lt;p&gt;OwnerName=&amp;quot;test27.manticore.org&amp;quot;&lt;/p&gt;
&lt;p&gt;In summary the fourth parameter in the documentation is the return information and we can ignore it if required.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3376636" width="1" height="1"&gt;</description></item><item><title>re: Manage DNS in a Windows Environment by Using PowerShell</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2010/09/13/manage-dns-in-a-windows-environment-by-using-powershell.aspx#3367667</link><pubDate>Thu, 11 Nov 2010 15:09:56 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3367667</guid><dc:creator>Laurence</dc:creator><description>&lt;p&gt;How does this line work?&lt;/p&gt;
&lt;p&gt;$rec.CreateInstanceFromTextRepresentation($server, $fzone, $text)&lt;/p&gt;
&lt;p&gt;Isn&amp;#39;t a fourth argument required? (&lt;a rel="nofollow" target="_new" href="http://msdn.microsoft.com/en-us/library/ms682714(v=VS.85).aspx"&gt;msdn.microsoft.com/.../ms682714(v=VS.85).aspx&lt;/a&gt;)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3367667" width="1" height="1"&gt;</description></item></channel></rss>