在AD中如果要新增组织单位,传统模式必须在Active Directory 使用者及电脑一个个建立,当然,透过script的自动化,也可以一次大量建立多个组织单位
wscript.echo"现在开始建立组织单位"'Determine the LDAP path for your domainSet Root=GetObject("LDAP://RootDSE")DomainPath=Root.Get("DefaultNamingContext")Set Domain=GetObject("LDAP://"& DomainPath)Set ouLab=Domain.Create("organizationalUnit","OU=新组织单位名称")ouLab.Put"Description","新组织单位名称"ouLab.SetInfowscript.echo"建立组织单位完成"Function CreateOU(claname)Set TargetOU=GetObject("LDAP://OU=新组织单位名称,"& DomainPath)Set newou=TargetOU.Create("organizationalUnit","OU="& claname)newou.Put"Description",clanamenewou.SetInfoEnd Function