Recipe 8.27. Publishing a Share in Active Directory


Problem

You want to publish a share in Active Directory so that other users can find it.

Solution

Using a graphical user interface

  1. Open the Active Directory Users and Computers (ADUC) snap-in.

  2. In the left pane, browse to the organizational unit (OU) in which you want to publish the share.

  3. Right-click the OU and select New Shared Folder (if you don't see the New heading then you don't have permission to create objects in the OU).

  4. For Name, enter the name of the share as you want it displayed to users.

  5. For UNC Path, enter the network path of the share (e.g., \\fs01\myshare).

  6. Click OK.

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

Discussion

After 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.

Another way to solve this problem is to use DFS, whereby you have a single directory tree of shared folders, but that is beyond the scope of this chapter.


See Also

MS KB 234582, "Publishing a Shared Folder in Windows 2000 Active Directory"



Windows XP Cookbook
Windows XP Cookbook (Cookbooks)
ISBN: 0596007256
EAN: 2147483647
Year: 2006
Pages: 408

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net