ProblemYou want to publish a share in Active Directory so that other users can find it. SolutionUsing a graphical user interface
Using VBScript' This code publishes a share in AD. ' ------ SCRIPT CONFIGURATION ------ strComputer = "ad-01" ' name of a domain controller strShareName = "Perl Libraries" strSharePath = "\\fs01\perl-libs" strShareDescr = "Core Perl libraries" set objRootDSE = GetObject("LDAP://" & strComputer & "/RootDSE") strParentDN = "/OU=SharedFolders," & objRootDSE.Get("defaultNamingContext") ' ------ END CONFIGURATION --------- set objOU = GetObject("LDAP://" & strComputer & strParentDN) set objVol = objOU.Create("volume", "cn=" & strShareName) objVol.Put "uncName", strSharePath objVol.Put "Description", strShareDescr objVol.SetInfo WScript.Echo "Successfully created object: " & objVol.Name DiscussionAfter you've created a shared folder, your users may not be able to find it or even know about it. One way to make available shared folders more accessible to users is by publishing them to Active Directory. Shared folders are represented by the volume object class in Active Directory. The main pieces of information you need in order to create a volume object are the share name, the share UNC path, and a share description. Users can search shared folders in Active Directory using the Find Users, Contacts, and Groups dialog box. You can get to this box by going to My Network Places and clicking Search Active Directory in the left pane, or by running the Active Directory Users and Computers snap-in, right-clicking the target domain in the left pane, and selecting Find. After the box is displayed, select Shared Folders beside Find, enter your search criteria, and click Find Now. The one major downside to publishing shares in Active Directory is the maintenance overhead. Unlike printer publishing in Active Directory, there is no automatic pruning or maintenance process that will clean up volume objects for shares that no longer exist. Unless you create a process to update Active Directory whenever a share is created, moved, or deleted, Active Directory will eventually become out-of-date and ultimately be an unreliable source of shared folder information.
See AlsoMS KB 234582, "Publishing a Shared Folder in Windows 2000 Active Directory" |