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)
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.

AcerKevUKAuthor Commented:
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.
Oops, I guessed wrong! :)  Here are the correct changes to make then:

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>

Change value "ChangeID" from dword:0387216a to dword:03878def
Change value "Attributes" from dword:00001000 to dword:00001400

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Hardware Profiles\0001\System\CurrentControlSet\Control\Print\Printers\<printer name>
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Hardware Profiles\0001\System\CurrentControlSet\Control\Print\Printers\<printer name>

Change value "PrinterOnLine" from dword:00000001 to dword:00000000

So a few more changes to make for this to work.  

By the way, if you ever need to figure this out in the future, I'll tell you my trick.  First off, you need a program called WinMerge (or another tool to compare differences between files).  You can get WinMerge here (it is freeware):

Now you need to export your entire registry file (or if you want to speed things up, only export HKLM or HKCU or whatever hive you think is affected).  Be sure to have regedit and the other program/activity up and ready to go before you do this.  If you make the change and then have to open regedit, it will flag other minor changes in the registry files and therefore cause more changes to show up between files.  Anyway, export the hive before the change and then again after the change.  Now open WinMerge and do a File >> Open and pick the before and after registry files.  Now you can click on the Merge menu and select "Next Difference".  Keep selecting the differences and recording the changes.  

After you do this a couple of times you'll get quite comfortable with the process.  It is a great way to find out how to manually manipulate the registry to do common tasks!


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

AcerKevUKAuthor Commented:
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 :


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.
AcerKevUKAuthor Commented:
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.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Networking

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.