title: Setting Win32_NetworkAdapterConfiguration's "SetDNSServerSearchOrder" method using powershell in pure IPv6 machine
body: <p><strong>SetDNSServerSearchOrder returns 70, Information from the MSDN is "invalid IP Address" for SetDNSServerSearchOrder</strong></p>
  
  <p>When I try with the IPv4 address it succeeds to add the DNS server. But when I try to give the IPv6 address instead of IPv4 address it doesn't work. </p>
  
  <ol>
  <li>Why it is not able to set the IPv6 address?                                                                                    </li>
  <li>What is the alternative for achiving this in IPv6 machine?</li>
  </ol>
  
  <p>Below is the code snippet what I tried. Also tried giving IPAddress and string datatypes as the input to SetDNSServerSearchOrder.</p>
  
  <pre><code>PS C:\Users\Administrator&gt; $NICs = Get-WmiObject Win32_NetworkAdapterConfiguration | Where {$_.IPEnabled -eq "TRUE" -and
   ($_.IPAddress -contains "1111:1111:1111:1111:1111:1111:1111:1114")}
  PS C:\Users\Administrator&gt; [System.Net.IPAddress]$IP="1111:1111:1111:1111:1111:1111:1111:1112"
  PS C:\Users\Administrator&gt; $IP
  
  
  Address           :
  AddressFamily     : InterNetworkV6
  ScopeId           : 0
  IsIPv6Multicast   : False
  IsIPv6LinkLocal   : False
  IsIPv6SiteLocal   : False
  IPAddressToString : 1111:1111:1111:1111:1111:1111:1111:1112
  
  
  
  PS C:\Users\Administrator&gt; $NICs.SetDNSServerSearchOrder($IP)
  
  
  __GENUS          : 2
  __CLASS          : __PARAMETERS
  __SUPERCLASS     :
  __DYNASTY        : __PARAMETERS
  __RELPATH        :
  __PROPERTY_COUNT : 1
  __DERIVATION     : {}
  __SERVER         :
  __NAMESPACE      :
  __PATH           :
  ReturnValue      : 70
  
  
  
  PS C:\Users\Administrator&gt; [string]$IP="1111:1111:1111:1111:1111:1111:1111:1112"
  PS C:\Users\Administrator&gt; $NICs.SetDNSServerSearchOrder($IP)
  
  
  __GENUS          : 2
  __CLASS          : __PARAMETERS
  __SUPERCLASS     :
  __DYNASTY        : __PARAMETERS
  __RELPATH        :
  __PROPERTY_COUNT : 1
  __DERIVATION     : {}
  __SERVER         :
  __NAMESPACE      :
  __PATH           :
  ReturnValue      : 70
  
  
  
  PS C:\Users\Administrator&gt; $IP
  1111:1111:1111:1111:1111:1111:1111:1112
  PS C:\Users\Administrator&gt; $NICs
  
  
  DHCPEnabled      : True
  IPAddress        : {fe80::24b7:d14e:fd15:bd2b, 1111:1111:1111:1111:1111:1111:1111:1114}
  DefaultIPGateway :
  DNSDomain        :
  ServiceName      : e1cexpress
  Description      : Intel(R) 82579LM Gigabit Network Connection
  Index            : 10
  
  
  
  PS C:\Users\Administrator&gt;
  </code></pre>
  
  <p>Below is the screenshot after running these commands. </p>
  
  <p><img src="https://i.stack.imgur.com/qiTMK.gif" alt="enter image description here"></p>
  
  <p>Also searched in Google and can't find a solution. :-(</p>
  
  <p>OS version: windows server 2008 r2</p>
  
  <p>Powershell version: Powershell 2.0</p>
  
  <p>Solution shall be unique so that I can use for both IPv4 and IPv6 systems.</p>
  
  <p>It would be great if anyone can help in this regard.</p>