Richard
Mon Aug 14 15:39:56 CDT 2006
beeni_man wrote:
>I am trying to bulk delete groups from AD using VBScript. I have a list
> of the distinguished names of the groups in an Excel spreadsheet.
>
> My problem is that the groups span accross several domains in my AD
> forest and i am unable to find a script which will delete an object
> purely by the distinguished name. All the scripts i have found have to
> at least bind to the domain container first.
>
> Can anyone help me with this?
>
Hi,
You can bind to the group object using the Distinguished Name, then use the
Parent method of the group object to retrieve the AdsPath of the parent
container. Then bind to the parent container. In brief:
strGroupDN = "cn=GroupA,ou=Sales,dc=MyDomain,dc=com"
Set objGroup = GetObject("LDAP://" & strGroupDN)
strParent = objGroup.Parent
Set objParent = GetObject(strParent)
--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab -
http://www.rlmueller.net