Link to home
Start Free TrialLog in
Avatar of AcerKevUK
AcerKevUK

asked on

Scripting take a printer offline/online XP

is there anyway (preferably from the command line i.e. DOS) to be able to take a printer offline or online under windows XP?

I have a number of scripts which currently set the firewall level, with offline and with exceptions being used only at home and everything being locked down on untrusted networks.

The printer is called "EPSON Stylus C82 Series (WiFi)", and windows treats it as a local printer although it is networked via LPD on my Belkin print server.

Ideally i would like the solution to work for proper networked printers as well (IPP/Cups and Samba/Windows) so i can use a simaler script at work.

(OS is Windows XP-SP2)
Avatar of masterbaker
masterbaker
Flag of United States of America image

I'm not sure if you want to pause printing or use the option to "Use Printer Offline".  I assume you want to pause the printer, so here's the difference in registry keys for pausing a printer:

The "Status" value changes from dword:00000180 to dword:00000181 in these three keys:

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Printer\Printers\<printer name>
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Printer\Printers\<printer name>
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\<printer name>

You will need to check out these three keys in regedit.exe to find the exact name of your printer.  Are you familiar with regedit?  Hopefully!  You will need to export these three values to three different files.  Then you can open the first with notepad and copy over the other two settings.  Now save the file.  Now make a copy of this file and change the value to ...181 instead of ...180.  Save this file.

You can then use the reg command to import these settings.  Add this reg command to a batch file and you can then add a shortcut to it.  Whew!

Here's the reg commad line:

reg import <filename>

Please post back if you need more details.

Jeff
Avatar of AcerKevUK
AcerKevUK

ASKER

I actually wanted to "Use printer offline" so i can still "print" :as far as word et al are concered) while at uni, and when i get home a single doubleclick would "use printer online" and start printing my jobs out

I am familier with importing and expoting registry keys, it's just finding the right one (or other method of changing things) that i struggle with.
ASKER CERTIFIED SOLUTION
Avatar of masterbaker
masterbaker
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the information, as a try i out i also used WinMerge and found the values were different, although the effected Keys were the same, i have therefore chosen to use my values.

For Online mode the values were :
"ChangeID"=dword:03fcfe8c
"Attributes"=dword:00000a00
"PrinterOnLine"=dword:00000001

"ChangeID"=dword:0400d626
"Attributes"=dword:00000e00
"PrinterOnLine"=dword:00000000

I've will also award an extra 100 points for the WinMerge tip off - thanks!

However for windows to take note of the changes you need to add the lines
net stop spooler
net start spooler
to your bat file after adding the registry entries.
In the previous comment the second set of values should hav been titled "and For Offline mode the values were" :
Ahh, guess I should have double checked with another computer to see if those values were different.  Good catch!  

I'm glad I was able to help out.

Jeff