Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
July 20, 2006
I have scripted DelDomGrpMbr.vbs to add a member to a group in a domain.
The syntax for using DelDomGrpMbr.vbs is:
cscript //nologo c:FOLDERDelDomGrpMbr.vbs GroupDn, MemberDN
Where:
GroupDN is the Distinguished Name of the group, like "CN=Domain Accountants,CN=Users,DC=JSIINC,DC=COM".MemberDN is the Distinguished Name of the member you wish to remove, like "CN=John Doe,CN=Users,DC=JSIINC,DC=COM".
DelDomGrpMbr.vbs contains:
dim objArguments, objGrpset objArguments = Wscript.Argumentsif objArguments.count 2 Then Wscript.Echo "Syntax: Cscript //nologo c:folderDelDomGrpMbr.vbs ""GrpDn"" ""MbrDN"""ELSEgrpdn = objArguments(0)mbrdn = objArguments(1)Const ADS_PROPERTY_DELETE = 4Set objGrp = GetObject("LDAP://" & grpdn)objGrp.PutEx ADS_PROPERTY_DELETE, "member", Array(mbrdn)objGrp.SetInfoEND IF
NOTE: See the following related scripts:
How can I use a VBScript to add a global security group to my domain?How can I use a VBScript to add a member to a group in my domain?
You May Also Like