PrinterCleanup.exe

 

Use caution when using PrinterCleanup!

Example 1: Using PrinterCleanup to control printer entries used by some applications

Problem: Some applications read registry entries to display the available printers. 

Background: There are 2 keys, HKCU\Software\Microsoft\Windows NT\CurrentVersion\Devices and

HKCU\Software\Microsoft\Windows NT\CurrentVersion\PrinterPorts, that contain the names of

printers. These keys are maintained by Microsoft, values are added when a printer is added and

removed when the printer is deleted. Windows does a poor job of maintaining these keys; usually

adding but not removing the values when a printer is deleted.

It’s usually not a problem but some poorly designed applications read the values in these keys and use

them as a valid printer list. A properly designed application uses the standard print dialog to display

printer choices for the user (Notepad and Word for example).

 Solution: PrinterCleanup.exe can help maintain these keys by removing invalid entries. Several customers are using this method and they love it.

Implementation: Setup a Run value to do the work when the User logs in:

PrinterCleanup.exe is in the C:\Program Files\Tricerat\ScrewDrivers\Endpoint folder for v7.  We will be using these two arguments:

-currentUser -sessionMatch

All PrinterCleanup program arguments are case sensitive.

 Running PrinterCleanup will produce a log each time it is run. If after careful testing, you wish to suppress the generation of the log, add this argument:

-noLog

Example complete command:

"C:\Program Files\Tricerat\ScrewDrivers\Endpoint\PrinterCleanup.exe" -currentUser -sessionMatch -noLog

Example 2: Using PrinterCleanup to remove orphaned printers.

Problem: When a user session is ended, our notification service removes the added printers from the server session. Sometimes things don’t go as planned and the users printer can be left behind. This can cause an issue for the users next session on that server.

Note: Please seek Tricerat Support guidance with these actions!

Solution: Open a CMD window on the server As Administrator. We need a CMD window because PrinterCleanup requires a command line argument to guide it’s actions and without it will generate an error:

To show the status of orphaned printers without doing anything, use:

This will produce a log in the C:\ProgramData\Tricerat\Logs folder that describes what actions it may take. This is safe to run anytime. If this step finds any issues, you can remove the -validate argument to perform the removal:

Please gather the generated logs and submit to Support for review.