Delete

Deletes the zone object from Active Directory.

Syntax

void Delete()

Discussion

To delete a zone, you must have the DeleteSubTree privilege on the zone’s parent container. For example, to delete a zone from the default location for new zones, you must have the right to DeleteSubTree allowed on the domain/Program Data/Acme/Zones container object.

Exceptions

Delete may throw one of the following exceptions:

  • UnauthorizedAccessException if you have insufficient access rights to delete the zone.

  • COMException if an LDAP error occurs. LDAP errors can occur if the connection to the LDAP server fails, the connection times out, invalidcredentials are presented, or there are other problems communicating with Active Directory.

Example

The following code sample illustrates using this method in a script:

...  
'Specify the zone you want to work with  
set objZone = cims.GetZone("ajax.org/UNIX/Zones/test_lab")  
'Delete the zone object  
objZone.Delete  
...