Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Need to configure advanced printer preferences using script.

Posted on 2008-06-11
5
Medium Priority
?
4,821 Views
Last Modified: 2008-08-02
I have a printer which I need to configure every time a user logs into an application...

Specifically I am looking for code which can modify the settings found in...

START > PRINTERS AND FAXES > {RIGHT CLICK A PRINTER} > {PuSh 'PRINTING PREFERENCES' Button} > SELECT 'DOCUMENTS' TAB > EXPAND 'PAPER/OUTPUT' OPTION ...

From here I need to programatically modify the settings in here, specifically I am interested in the 'Top Adjustment' setting.
0
Comment
Question by:Blowfelt82
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 65

Accepted Solution

by:
RobSampson earned 2000 total points
ID: 21764498
Hi, you cannot modify such properties via VBScript.

What I do in such cases, is set up a Printing Preferences QuickSet configuration on the Print Server.  You can do this directly on the print server in the Printing Preferences section, and the Advanced --> Printing Defaults section.

This QuickSet then gets pushed out to all clients that are connected to it.  Then, before the user loads that application, then need to set their own Printing Preferences to that pre-created QuickSet, and then run the application, and then change back the Printing Preferences.

It's a bit of a pain, but as least with a QuickSet configuration, you can set up multiple settings at the click on one button.

Regards,

Rob.
0
 
LVL 2

Expert Comment

by:JManicki
ID: 22694817
Well Rob, technically that's not true.

It is almost true that you can't directly set those options using VBSCript.  The only reason why is that the Registry modification methods available to VBScript cannot easily handle modifying a very large REG_BINARY value which is how Printer Preferences are stored, but you CAN do it with a VBScript login script using some help from REGEDIT.EXE and an exported .REG file.  It's fairly easy to do and I'm automagically configuring dozens of printers and print preferences each day with this method.

I'm printer preference options are stored in the Registry under HKEY_CURRENT_USER\Printers\DevModePerUser and also HKEY_CURRENT_USER\Printers\DevMode2.   I think the DevModePerUser is the configuration of the printer itself (or maybe just the defaults?) and the DevMode2 is the Printing Preferences but I'm not 100% on that so I always use both.

In those keys, you should see an entry for every printer name that's installed on your computer.  As I said, I think DevMode2 is for Printing Preferences so until you actually change them from the default, there may not be an entry there for a specific printer.

What I do is create a printer.  Modify all settings that I need.  Next I use REGEDIT.EXE to browse to and export the HKEY_CURRENT_USER\Printers\DevModePerUser and HKEY_CURRENT_USER\Printers\DevMode2 registry keys.  One I export them, I use a text editor and create separate files for each printer containing the REG_BINARY values from EACH key for only that printer.  Make it easy on yourself and name the files the same name as the printer if at all possible.

Once you have the configurations for all your printers, save/copy them to a shared folder accessible to your users.  In the login script, just add the command to use REGEDIT.EXE to import your .REG file.

If you're using VBSCript, use the following command with the WScript Run Method:

Set WshShell = Wscript.CreateObject("WScript.Shell")
WshShell.Run "REGEDIT.EXE /S \\SERVERNAME\SHARENAME\REGFILENAME.REG",0,True

Substitue SERVERNAME with the name of your server, SHARENAME with the name of the shared folder that the .REG files are in and REGFILENAME with the name of the .REG file itself.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 22699461
JManicki, well, you've certianly done your homework there, very well done!

I apologise for leading you down the wrong track.

So it can be done with a bit of manual work, certianly not what you'd call dynamic (initially), but it definately gets the job done once you've got your *.reg files ready for importing.

Nice work.

Regards,

Rob.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question