<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Indented! &#187; wmic</title>
	<atom:link href="http://www.indented.co.uk/index.php/tag/wmic/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.indented.co.uk</link>
	<description></description>
	<lastBuildDate>Mon, 17 Oct 2011 19:03:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Microsoft DNS &amp; static records</title>
		<link>http://www.indented.co.uk/index.php/2008/10/02/microsoft-dns-static-records/</link>
		<comments>http://www.indented.co.uk/index.php/2008/10/02/microsoft-dns-static-records/#comments</comments>
		<pubDate>Thu, 02 Oct 2008 11:59:32 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Microsoft DNS]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[VbScript]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[reporting]]></category>
		<category><![CDATA[vbs]]></category>
		<category><![CDATA[Windows 2003]]></category>
		<category><![CDATA[wmi]]></category>
		<category><![CDATA[wmic]]></category>

		<guid isPermaLink="false">http://www.highorbit.co.uk/?p=28</guid>
		<description><![CDATA[Windows 2008 has an improved user interface for DNS. The main console includes details of a records time stamp and whether or not the record is Static. Life isn&#8217;t quite so easy with Windows 2003. However, as each static record has a time stamp set to 0 they can be found with a little work. [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Windows 2008 has an improved user interface for DNS. The main console includes details of a records time stamp and whether or not the record is Static. Life isn&#8217;t quite so easy with Windows 2003. However, as each static record has a time stamp set to 0 they can be found with a little work.<br />
<span id="more-28"></span><br />
When using an Active Directory Integrated zone records are stored within Active Directory as dnsNode objects. The Time Stamp value is encoded along with the rest of the record properties (TTL, etc) in the dnsRecord attribute on the dnsNode. The attribute is a Binary Large Object (BLOB), Microsoft do not currently publish references or maps for these attributes. WMI queries can be used as an alternative.</p>
<h3>The DNS management console</h3>
<p>To see the current time stamp, and whether a record is dynamic or not first enable View / Advanced in the DNS console. For each record that makes an additional tick box and text box visible.</p>
<p>The record below is dynamic, if the box is not ticked, and the time stamp field is blank the record is static. That means that unticking the box stating the record can be scavenged changes the record to static.</p>
<p><a href="http://www.indented.co.uk/wp-content/uploads/2008/10/dynamicrecord.jpg"><img class="aligncenter size-medium wp-image-52" title="Dynamic Record" src="http://www.indented.co.uk/wp-content/uploads/2008/10/dynamicrecord-270x300.jpg" alt="" width="270" height="300" /></a></p>
<h3>DNSCMD</h3>
<p>DNSCMD installs along with the Windows Support Tools. It can be used to identify static records, although it can be very difficult pulling the results out of a list like this.</p>
<p><em>For example:</em></p>
<pre class="brush: plain; title: ; notranslate">
dnscmd /ZonePrint somedomain.example
</pre>
<h3>WMIC</h3>
<p>WMIC, Windows Management Instrumentation Command-Line, will install the first time it is run. As the name suggests, it allows execution of WMI queries on the command line.</p>
<pre class="brush: plain; title: ; notranslate">
WMIC /NAMESPACE:&quot;\\root\MicrosoftDNS&quot; PATH &quot;MicrosoftDNS_AType&quot; WHERE &quot;ContainerName='somedomain.example’ AND TimeStamp=0&quot; GET &quot;OwnerName,TTL,TimeStamp&quot;
</pre>
<p>Or</p>
<pre class="brush: plain; title: ; notranslate">
WMIC /NAMESPACE:&quot;\\root\MicrosoftDNS&quot; PATH &quot;MicrosoftDNS_AType&quot; WHERE &quot;TimeStamp=0&quot; GET &quot;OwnerName,TTL,TimeStamp&quot;
</pre>
<h3>VbScript</h3>
<p>This VbScript snippet echoes each static record, it is works best when run with cscript.</p>
<pre class="brush: vb; title: ; notranslate">
strServerName = &quot;dc01.somedomain.example&quot;
strContainerName = &quot;somedomain.example&quot;

Set objWMIService = GetObject(&quot;winmgmts:\\&quot; &amp; strServerName &amp; _
  &quot;\root\MicrosoftDNS&quot;)
Set colItems = objWMIService.ExecQuery(&quot;SELECT * FROM MicrosoftDNS_AType &quot; &amp;_
  &quot; WHERE ContainerName='&quot; &amp; strContainerName &amp; &quot;' AND TimeStamp=0&quot;)

For Each objItem In colItems
  WScript.Echo objItem.OwnerName &amp; VbTab &amp; objItem.IPAddress &amp; VbTab &amp; &quot;Static&quot;
Next

Set colItems = Nothing
Set objWMIService = Nothing
</pre>
<h3>PowerShell</h3>
<pre class="brush: powershell; title: ; notranslate">
$ServerName = &quot;dc01.somedomain.example&quot;
$ContainerName = &quot;somedomain.example&quot;

Get-WMIObject -Computer $ServerName `
    -Namespace &quot;root\MicrosoftDNS&quot; -Class &quot;MicrosoftDNS_AType&quot; `
    -Filter &quot;ContainerName='$ContainerName' AND TimeStamp=0&quot; `
  | Select-Object OwnerName,TTL, @{n=&quot;TimeStamp&quot;;e={&quot;Static&quot;}}
</pre>
<p>The same search can be used for any record type, by changing the WMI class. The options most likely to be useful are:</p>
<ul>
<li>MicrosoftDNS_AType &#8211; Address or Host records</li>
<li>MicrosoftDNS_CNAMEType &#8211; Alias records</li>
<li>MicrosoftDNS_MXType &#8211; Mail Exchanger records</li>
<li>MicrosoftDNS_NSType &#8211; Name Server records</li>
<li>MicrosoftDNS_SRVType &#8211; Service records</li>
<li>MicrosoftDNS_PTRType &#8211; Pointer records (Reverse Lookup zone)</li>
</ul>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.indented.co.uk/index.php/2008/10/02/microsoft-dns-static-records/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

