Creation of Global Security groups in Active Directory

' Creation of Global secutiry Groups in domain
' This Script has been successfully tested in Windows 2003 AD
Set objRootDSE = GetObject("ldap://RootDSE/")
strDNSDomain = objRootDSE.Get("DefaultNamingContext")

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\Groups.txt",1)

Set objOU = GetObject("ldap://OU=Test/,"& StrDNSDomain)

Do While objFile.AtEndOfStream = False
strGroup = objFile.ReadLine
Set objGroup = objOU.Create("Group", "cn="& StrGroup)

objGroup.Put "sAMAccountName", StrGroup
objGroup.SetInfo
Set ObjGroup = nothing
Loop
Wscript.echo "Done"

' End of Script

***Share your comments about the post***

No comments:

Post a Comment