Title: Active Directory Subnets

I have a question about AD Subnets and programmatically adding them to Sites.  We have a rather large list of subnets that need to be assigned to Sites and I didn't want to hand-to-hand combat those entries if possible.

I was looking at using this script I found at Microsoft, but was wondering what some other AD sites have done in the past.  Or maybe someone has a better suggestion than the script below.

Thanks,

Jason

Creating an Active Directory Subnet

Description
Creates an Active Directory subnet.

Script Code

strSubnetRDN     = "cn=192.168.1.0/26"

strSiteObjectRDN = "cn=Ga-Atl-Sales"

strDescription   = "192.168.1.0/255.255.255.192"

strLocation      = "USA/GA/Atlanta"

Set objRootDSE = GetObject("LDAP://RootDSE")

strConfigurationNC = objRootDSE.Get("configurationNamingContext")

strSiteObjectDN = strSiteObjectRDN & ",cn=Sites," & strConfigurationNC

strSubnetsContainer = "LDAP://cn=Subnets,cn=Sites," & strConfigurationNC

Set objSubnetsContainer = GetObject(strSubnetsContainer)

Set objSubnet = objSubnetsContainer.Create("subnet", strSubnetRDN)

objSubnet.Put "siteObject",  strSiteObjectDN

objSubnet.Put "description", strDescription

objSubnet.Put "location",    strLocation

objSubnet.SetInfo      

Reply via email to