How To Set a User's Default Local Printer with a Logon Script

IMPORTANT: This article contains information about modifying the registry. Before you modify the registry, make sure to back it up and make sure that you understand how to restore the registry if a problem occurs. For information about how to back up, restore, and edit the registry, click the following article number to view the article in the Microsoft Knowledge Base:
256986 Description of the Microsoft Windows Registry

Summary

When a user connects to a Terminal Server computer in a client session, he or she may be locked down to only one application. If this application does not allow for selecting the default printer, the user will not be able to specify a printer other than the default. To make it possible for all users to specify the printer closest to them, the default printer must be set using a regini script.


NOTE: Regini.exe is available in the Windows NT Resource Kit.


WARNING: If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk.
  1. In Terminal Server, run Regedt32 and go to the following key:

    HKEY_CURRENT_USER/Software/Microsoft/WindowsNT/Currentversion/Devices
    Here you will see a list of your existing printers. An example of one of the key values may look like this:

    HP LaserJet 5Si : REG_SZ: winspool,Ne00
    NOTE: This is a local printer, NOT a network printer.

    The first text string is the text name of the printer, and the last two numbers in Ne00 will be the order in which the printer was added to the server for a TCP/IP printer. It could be, for example, LPT1: for a direct connected printer. Take note of all the printers listed here. These printer would have had to been installed by a local administrator.
  2. Create a text file and name it SomeFileName.ini. One of theses files will be needed for each printer you need to assign as default. The file should look like this:

    HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows
    Device = DELETE

    HKEY_CURRENT_USER\Printers
    DeviceOld = DELETE

    HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows
    Device = "[text name of printer],winspool,Nexx:"

    HKEY_CURRENT_USER\Printers
    DeviceOld = "[text name of printer],winspool,Nexx:"
    NOTE: Do not forget the colon (:).

    NOTE: xx is the Ne number for the specific printer you would like to use with this file.

    NOTE: Device = "[text name of printer],winspool,Nexx:" is case sensitive.
  3. After all your files have been created for each printer, you must add the following line to the logon script of each user:

    regini [path]\SomeFileName.ini > Nul:

More Information

By default, only printers that are attached to a local port on the server will be pushed to all users logging on to the Terminal Server computer. This includes printers connected through TCP/IP printing.
Propiedades

Id. de artículo: 196732 - Última revisión: 06/22/2014 - Revisión: 1

Comentarios