Deleting a Published Folder in Active Directory

Microsoft® Windows® 2000 Scripting Guide

Because a published folder is simply an Active Directory object, it can be deleted using an ADSI script: You bind to the object and then use the DeleteObject method to remove it from Active Directory.

Deleting a published folder does not delete the contents of that folder, nor does it stop the sharing of that folder. Instead, it merely removes the folder from Active Directory.

Scripting Steps

Listing 11.41 contains a script that deletes a published folder from Active Directory. To carry out this task, the script must perform the following steps:

  1. Use a GetObject call to connect to the shared folder object in Active Directory.

  2. Use the DeleteObject method to delete the shared folder.

    The DeleteObject method requires the parameter (0). This is currently the only parameter that can be used with this method.

Listing 11.41 Deleting a Published Folder in Active Directory

  
1
2
3
Set objContainer = GetObject("LDAP://CN=FinanceShare, " _
 & "OU=Finance, DC=fabrikam, DC=com")
objContainer.DeleteObject (0)