title: VB Scipt to add Subnets to Active Directory Sites - Check is subnet exists
body: <p>I'm planning to use the following to add subnets to Active Directory Sites.</p>
  
  <p>We are working on upgrading the environment to 2008 R2 so in the furture we can use powershell to administer AD, but for the moment we are doing this with VB.</p>
  
  <pre><code>    ' ------ SCRIPT CONFIGURATION ------
  strSubnet = "&lt;Subnet&gt;"   ' e.g. 10.5.3.0/24
  strSite   = "METRO" 
  ' ------ END CONFIGURATION --------
  
  set objRootDSE = GetObject("LDAP://RootDSE")
  set objSubnetsCont = GetObject("LDAP://cn=subnets,cn=sites," &amp; _
                                 objRootDSE.Get("configurationNamingContext") )
  set objSubnet = objSubnetsCont.Create("subnet", "cn=" &amp; strSubnet)
  objSubnet.Put "siteObject", "cn=" &amp; strSite &amp; ",cn=sites," &amp; _
                                 objRootDSE.Get("configurationNamingContext")
  objSubnet.SetInfo
  
  WScript.Echo "Successfully created subnet " &amp; strSubnet
  </code></pre>
  
  <p>Can someone please let me know how I can add in a line to check is the subnet already exists?</p>
  
  <p>Thank you.</p>
  
  <p>Amelia</p>