title: How to Update DNS Records Programatically
body: <p>I am trying to update a DNS Record which is at (I believe) the following path on the server:</p>
  
  <p><code>ServerName -&gt; Forward Lookup Zones -&gt; domain.com -&gt; test</code></p>
  
  <p>Where the DNS record is called <code>test</code>, and is of type <code>Host(A)</code>.</p>
  
  <p>I downloaded the <code>DNSShell</code> module from <a href="http://dnsshell.codeplex.com/" rel="nofollow">here</a> and tried changing the 'Data' column of the DNS record (which contains an IP address) with this command:</p>
  
  <p><code>Set-DNSRecord -Identity "test.domain.com"</code></p>
  
  <p>But I got this error:</p>
  
  <blockquote>
    <p>Cannot validate argument on parameter 'Identity'. The argument "test.domain.com" does not match the "^\\.<em>\root\MicrosoftDNS:MicrosoftDNS_" pattern. Supply an argument that matches "^\\.</em>\root\MicrosoftDNS:MicrosoftDNS_" and try the command again.</p>
  </blockquote>
  
  <p>So I updated the <code>Identity</code> parameter as follows:</p>
  
  <p><code>Set-DNSRecord -Identity "\\Servername\root\MicrosoftDNS:MicrosoftDNS_"</code></p>
  
  <p>But now I am seeing:</p>
  
  <blockquote>
    <p>Set-DNSRecord : Specified argument was out of the range of the valid values. Parameter name: Path</p>
  </blockquote>
  
  <p>When I try adding a <code>-Path</code>, it says there is not such parameter! Does anyone know where I need to add the <code>test.domain.com</code> part of the DNS to tell the command which record to update? The documentation on this module is incomplete for this part of it and I can't seem to find any alternatives. </p>
  
  <p>I can call <code>Get-DNSRecord</code> and see the record I need to update, but any attempts to <code>Set</code> are blocked because I have no idea how these paths are built.</p>
  
  <p>Any help is much appreciated. </p>