Script Deletes Orphaned Printer Ports

The script published in this article was kindly contributed by Bo Riis, a sysadmin working at Danish hosting company dandomain. Here is what he writes about it:

Recently I had some issues with MS Office getting really slow on some of our customers’ terminal servers. After some intensive debugging we came to the conclusion that when users disconnected a session they left behind their open printer ports. It seems like that these ports don’t get cleaned up after a while, like the session they belong to. These ghost ports linger and use more and more resources in the print spooler and Office does not react well to a busy print spooler. One of our servers had more than 3000 of these orphaned ports. [Whoa!]

After searching a little we found one reference to this problem on Brian Madden’s forum. From the scripts there I compiled a script that works on Windows XP and up.

We now have this running on almost 200 TS and the users have given positive feedback on performance gains. Depending on how well or bad behaved they were in logging off in the first place.

Bo runs this script weekly on their terminal servers under the system account. There are two versions which are identical except for the logging capabilities.

Download

CleanupOrphanedPrinterPorts.zip
CleanupOrphanedPrintersWithLogfile.zip

Comments

Related Posts

Citrix Synergy 2016 Call for Topics: Get Rid of the Video Requirement (Open Letter)

It smacks of lazy reviewers looking for eye-candy. Simon Crosby, former Citrix CTO Citrix Synergy Team, I am writing to you as a guy who has presented many times at Synergy. This year alone I had three sessions, one in cooperation with my community peers Aaron Parker and Shawn Bass, the other two on my own - one in the Geek Speak track, the other in the regular Synergy breakout session track. All three sessions were a great success and have been rated highly.
Citrix/Terminal Services/Remote Desktop Services

Latest Posts