Thursday, December 4, 2008

Deleting an Active Directory Subnet

Deletes an Active Directory subnet.

strSubnetCN = "cn=192.168.1.0/26"
 
Set objRootDSE = GetObject("LDAP://RootDSE")
strConfigurationNC = objRootDSE.Get("configurationNamingContext")
 
strSubnetsContainer = "LDAP://cn=Subnets,cn=Sites," & strConfigurationNC
 
Set objSubnetsContainer = GetObject(strSubnetsContainer)
objSubnetsContainer.Delete "subnet", strSubnetCN

This is a VB Script, this can be used by saving the file in .vbs file