Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a program (environment is Windows 7 Enterprise 32bit) that scans available serial ports to detect a specific device.

But on many machines a printer driver is configured on one of the serial port (this does not means that there is actually a printer connected to that port). In this case, my scan program can't open that port to search the device.

On Windows XP, stopping the spooler before starting the scan was enough to unlock serial ports allocated by the printer drivers. On Windows 7, this is not working anymore. If I have a printer configured on COMx and I stop the spooler, COMx can't be opened.

I've checked process locks with ProcExp: ports results allocated by spoolsv.exe process when spooler is running, and results NOT allocated by anyone when the spooler is stopped.

Any idea about how to momentarily unlock ports allocated by printers?

A workaround I found is to change port of every serial printer to FILE: before the scan and back to the COMx when the scan finished, but I wonder if there is a simpler solution.

share|improve this question
Have you tried a utility like Unlocker? See if you can remove the locking handle rather than killing spooler. (Wait, would that even work on a locked COM port? well, it's a thought, at least.) – HopelessN00b Aug 24 '12 at 15:25
Unlocker does not work with serial ports. But ProcExp (Process Explorer) can search specific names locked amongst all processes' handles. And it found no lock on serial ports when spooler is stopped. – Axeman Aug 24 '12 at 17:45

I had a similar problem which was solved by changing the port name from COM1 to COM4 in the serial port advanced properties (via the device manager).

Everything then worked fine. Some programs still see the renamed port as COM1, but now they can access the port.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.