One common application for Active Directory (AD) is to publish resources such as shared folders and printers to enable users to easily locate and use those resources. Rather than browse the network looking for a printer, for example, clients can browse the directory. This typically makes it easier for users to locate resources because they don’t need to know the physical location or the server that handles the resource. But exactly how do you publish resources using AD? In this Daily Feature, I’ll show you.

Publishing shared folders
You can publish shared folders—including distributed file system (DFS) folders—quite easily in Windows 2000. The shared folder need not be hosted on a domain controller or even on a Windows 2000 computer. For example, you might share a folder on a user’s Windows 98 computer and then publish that folder in AD so users can find it easily. Sharing a folder doesn’t publish it in the directory, however, so you must use a two-step process to publish the folder. First, share the folder and then publish it in the directory.

To share the folder, locate and right-click the folder and then choose Sharing. Configure the share properties as needed to control access to the share. Next, if the share resides on an NTFS volume, configure the NTFS permissions for the share and any subfolders to fine-tune security as needed.

After the folder is shared, you can publish it in AD. To do so, open the Active Directory Users And Computers console. Locate the container in which you want to publish the folder, right-click the container, and choose New | Shared Folder. The console prompts you for the resource name, which is the name by which the shared folder is listed in the directory and the name users see when they browse the directory. The console also prompts you for the share name, which you enter in UNC form, such as \\server\share. The console doesn’t check availability of the share when you publish it, so the share need not be created prior to publishing it. You should create the share first, however, because users will see it advertised immediately in the directory.

When you need to access a published share, do so through the Directory object in My Network Places. Open the Enter Network object, click Entire Contents, open the Directory object, open the domain, and then open the container where the shared folder is stored. Double-click the folder to open it and access its contents.

Publishing shared printers
In addition to publishing shared folders, you can publish shared printers. Windows 2000 automatically publishes printers when you add them on a Windows 2000 domain member. You can add a printer to the directory easily through the properties for the printer. Open the Printers folder, right-click the printer, and choose Sharing. Select the Listed In The Directory option and click OK. Users who need to add a published printer to their computers can do so through the Add Printers wizard. Start the wizard on the client computer, choose the Network Printer option, choose the Find A Printer In The Directory option, and click Next. Follow the prompts to complete the installation.

You also can publish printers from non-Windows 2000 computers in the directory, using either the Active Directory Users And Computers console or the Pubprn.vbs script. You’ll find Pubprn.vbs in the %systemroot%\System32 folder on the server.

To add printers through the Active Directory Users And Computers console, right-click the container in which you want the printer to be published and choose New | Printer. Enter the path to the network printer when prompted and click OK.

The Pubprn.vbs script method lets you publish multiple printers in a single task. For example, you can publish all printers hosted by a specific server to the directory. Or you might use multiple executions of Pubprn.vbs in a single master script to publish printers from several servers. The syntax for executing Pubprn.vbs is:
cscript pubprn.vbs <servername> <dspath>

Replace <servername> with the name of the server on which the printers are hosted and replace <dspath> with the path to the storage container in the directory where you want the printers published. For example, you would use the following command to publish all printers from a server named Printsrv to the Support OU in the domain:
Cscript pubprn.vbs printsrv “LDAP://ou=support,dc=techrepublic,dc=com”

The script publishes the Location, Model, Comment, and UNC Path properties for the server. You can run the script again to update the directory in order to reflect changes at the print server. Use the Active Directory Users And Computers console to make other changes to the published printer.
The authors and editors have taken care in preparation of the content contained herein but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for any damages. Always have a verified backup before making any changes.