Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBScript to Delete Active Directory Connection Objects

Status
Not open for further replies.

djtech2k

MIS
Jul 24, 2003
1,097
US
I need some guidance to delete some connection objects in Active Directory Sites and Services. I have code to report the objects, I just need the confirmation on the delete portion. I am guessing its something like "objConn.Delete".

Here is the code to report them out:

Code:
' ------ SCRIPT CONFIGURATION ------
strServer = "<ServerName>"  ' e.g. dc01
strSite   = "<SiteName>"    ' e.g. MySite1
' ------ END CONFIGURATION ---------

set objRootDSE = GetObject("LDAP://RootDSE")
set objNTDSCont = GetObject("LDAP://cn=NTDS Settings,cn=" & strServer & _
                            ",cn=servers,cn=" & strSite & ",cn=sites," & _
                             objRootDSE.Get("configurationNamingContext") )
objNTDSCont.Filter = Array("ntdsConnection")
WScript.Echo "Connection objects for " & strSite & "\" & strServer
for each objConn in objNTDSCont
   if objConn.Get("options") = 0 then
      Wscript.Echo "  " & objConn.Get("cn") & " (MANUAL)"
   else
      Wscript.Echo "  " & objConn.Get("cn") & " (AUTO)"
   end if
next
 
I don't know the official documentation to the effect that it "must". But it always has been in practice. As it is reserved, it is probably the fear that one day they would work on that paramter to add features.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top