This blog simply records all I've learned for IT knowledge.

Tuesday, July 15, 2008

Install fake printers on Windows 2000

Motivation: when doing automation tests, we might need fake printers.

Procedure for installation:

  1. Control Panel -> Printers -> Add Printer
  2. Select Local Printer, uncheck "Automatically detect and install my Plug and Play printer", click Next
  3. Instead of selecting an existing port, select "Create a new port" and select type as "Local Port"
  4. Enter a port name (e.g. fakeprinter. Note that the default path for this is C:\Windows\System32)
  5. Choose "Generic" as Manufacturers, and "Generic/Text Only" as Printers type (Note: you may be able to choose any other type of printer, like HP, Apple).
  6. Options: If you want to delete a printer port you just created, first delete the printer that is using the port. Then go to "Printers" windows, click "File->Server Properties->Ports". There you have authority to delete a print port.

Procedure for using the fake printer from windows cmd (lanman printing)

  1. In cmd, run "net use lpt2: \\<samba-or-windows-server>\<fake-printer-name>"
  2. Options: if you want to disconnect a mapped drive, simple type "net use x: /delete", where x: is the driver letter of the shared resource
  3. To print your file to fake printer, just use "copy lpt2" (check the file C:\Windows\System32\ to make sure it is updated)

No comments: