'# From the book "Managing Enterprise Active Directory Services"
'# ISBN: 0-672-32125-4
Dim new_subnet, subnet_site, user, passwd, server, sites_dn
Dim siteObj, ldapObj, subnetObj
new_subnet = "10.5.5.0/24"
subnet_site = "RTP"
server = "dc1.xyz.com"
user = "administrator@xyz.com"
passwd = "password"
' This could be dynamically computed using RootDSE
sites_dn = "cn=sites,cn=configuration,dc=xyz,dc=com"
Set ldapObj = GetObject("LDAP:")
Set sitesObj = ldapObj.OpenDsObject("LDAP://" & server & "/" & sites_dn, _
user, passwd, 1)
Wscript.Echo "Creating subnet " & new_subnet
Set subnetObj = sitesObj.Create("subnet","cn=" & new_subnet & ",cn=Subnets")
subnetObj.Put "siteObject","cn=" & subnet_site & "," & sites_dn
subnetObj.SetInfo()
Wscript.Echo "Subnet creation complete"
|