R
Robin Briggs
I have found a useful code snipet on the MS web site to
add subnets to AD Sites & Services. Works well for one
subnet as you have to enter the subnet information into
the script. I have to add 1,000+ subnets and would prefer
to be able to specify an input file rather than having to
cut/past or type this information for each subnet into
the script, one at a time. I have a csv file that
contains the subnet name, siteobject name and description
which is all I want to enter for each subnet.
The code I am using is as follows:
strSubnetRDN = "cn=192.168.1.0/26"
strSiteObjectRDN = "cn=USA-SITE1"
strDescription = "Bldg. 1, Rochester, NY"
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.SetInfo
Any help anyone can offer is appreciated.
add subnets to AD Sites & Services. Works well for one
subnet as you have to enter the subnet information into
the script. I have to add 1,000+ subnets and would prefer
to be able to specify an input file rather than having to
cut/past or type this information for each subnet into
the script, one at a time. I have a csv file that
contains the subnet name, siteobject name and description
which is all I want to enter for each subnet.
The code I am using is as follows:
strSubnetRDN = "cn=192.168.1.0/26"
strSiteObjectRDN = "cn=USA-SITE1"
strDescription = "Bldg. 1, Rochester, NY"
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.SetInfo
Any help anyone can offer is appreciated.