Solved

Registry setting for default printer

Posted on 2004-04-28
13
19,892 Views
Last Modified: 2011-08-18
Hi,

What is the registry setting for the current selected default printer.
It is some kind of combination of printer-name, port all contained in a ','-seperated string.

For the port in case of a file-port.
*Is it possible to change the port-directory by changing the registry setting.
*Is the printer-definition also affected when the registry-setting is changed.
*And is it possible to force this registry setting to be a named file instead of a directory.

Thanx,
Alexander
0
Comment
Question by:aperdon
  • 6
  • 6
13 Comments
 
LVL 4

Expert Comment

by:scorpiia
ID: 10937107
HKey_Current_User\Printers
0
 
LVL 1

Author Comment

by:aperdon
ID: 10937330
Not something like this for the current printer? But this one doesnot exist in my Registry.

HKCU:Software\Microsoft\Windows NT\CurrentVersion\Windows\Device

But when I debug through some code which reads from registry it reads from group="Windows" item="Device".


Let me check at home (at work now without any registry privileges) what is in this registry-dir you specified. Is there only the printer-definitions there or also some info about current default printer.
0
 
LVL 21

Expert Comment

by:gemarti
ID: 10937437
Here is a script that uses WMI to set the default printer. Maybe it will help....
Set the Default Printer
http://www.microsoft.com/technet/community/scriptcenter/printing/scrprn44.mspx

+++++++Start Script+++++++++++
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colInstalledPrinters =  objWMIService.ExecQuery _
    ("Select * from Win32_Printer Where Name = 'ScriptedPrinter'")
For Each objPrinter in colInstalledPrinters
    objPrinter.SetDefaultPrinter()
Next
++++++++END SCRIPT+++++++++
0
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
LVL 21

Expert Comment

by:gemarti
ID: 10937471
This should be applicable in XP:

Changing a User's Default Printer in the Registry
http://support.microsoft.com/default.aspx?scid=kb;en-us;156212

SUMMARY
There are times when you want to change the default printer of a user or group of users without having access to the user's (or users') computer(s). You can do this by making a registry entry.

The information in this article applies to:
Microsoft Windows 2000 Server
Microsoft Windows 2000 Advanced Server
Microsoft Windows 2000 Professional
Microsoft Windows NT Workstation 3.5
Microsoft Windows NT Workstation 3.51

6/3/2003
0
 
LVL 21

Expert Comment

by:gemarti
ID: 10937502
BTW: The KEY that scorpia gives only directs you to the location that indicates what printers the user has set up, not the default printer. :(
0
 
LVL 1

Author Comment

by:aperdon
ID: 10937572
I dont have "HKCU\\Software\Microsoft\Windows NT\CurrentVersion\Windows:Device" in my registry in my XP. Yet I am able to query the registry for "Windows:Device" to get the current default printer. Very confusing. You have this key in ur XP registry?

Will the script as you provided work in VBA? Can I just use Get/Set ProfileString Win32 Api's to do the trick?

The "string" defined by Device denotes : <name>,<driver>,<port>

What can I do with this <port>. Can I force this port to send output to a named-filename.Or is <port> always a directory. Will changing the <port> part for the default printer afftect the printer settings as defined for the same named printer in HKCU\\Printers.

Indeed, I assumed that scorpia-s KEY only is for the printer definitions.

0
 
LVL 1

Author Comment

by:aperdon
ID: 10947118
You are right about the key. I found it. I cant see any reason why i did it not see it time over time..... Must have looked at 1000 times and always overlooked it.

I played around with the default printer key. Changing port part does not affect to which dir the output-file is written.
But however, there is a Port key inside the printer-definition key. I will try that one.

Do you have any experience with changing port-spool-directories?
0
 
LVL 21

Expert Comment

by:gemarti
ID: 10948910
>>Will the script as you provided work in VBA? Can I just use Get/Set ProfileString Win32 Api's to do the trick?
You can save it as a VBS script and it should run in XP with no problems. If you do have a problem then make sure the Windows Management Instrumentation Service is running (START | RUN | SERVICES.MSC)


>>What can I do with this <port>.
I think you can either send the print job to a local printer port, such as LPT1 or to a network shared printer. I think the only way to send a print job to a file is to select that option when prompted by the print dialog.

>>Do you have any experience with changing port-spool-directories?
Yes. It is a registry hack as well. You have to tell the system where the new spool directory is located.
0
 
LVL 21

Expert Comment

by:gemarti
ID: 10948936
To change the default printer spool directory
http://www.nthelp.com/351/spooldir.htm
0
 
LVL 1

Author Comment

by:aperdon
ID: 10948964
>>Do you have any experience with changing port-spool-directories?
Yes. It is a registry hack as well. You have to tell the system where the new spool directory is located.

So without creating a new port. Just change the Port key to whatever spool-dir. Right?
Can you share your experiences in this, especially if it comes to named-file spooling. That is: Can I specify an output-file-name in the Port-key and to force the spooler to write to that file.
0
 
LVL 1

Author Comment

by:aperdon
ID: 10949019
Ok. I see you posted another comment while I was typing mine.

Any experience with this SpoolDirectory? This is like 'Port' right, in case of a file-based port. SpoolDirectory probably wont be used by other type of port-printing like printing to for example to LPT1:.
0
 
LVL 21

Accepted Solution

by:
gemarti earned 100 total points
ID: 10950500
My only experience with SpoolDirectory is that on my print server I changed the spool directory to a different drive so as to not create problems on the drive that my system is installed on. I'm not exactly sure of what you are asking. If your wanting to print to file then I believe the file is stored in that spool file directory until it is released, but I'm not real sure about that.
0
 
LVL 1

Author Comment

by:aperdon
ID: 10950524
Ok. I will test it. Thanx for the new info sofar again.
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Copy a User Account in Win7 & Win8 11 137
Application Not Found 3 97
Windows 7 and Pro update issues 5 89
Move windows 10 users 8 48
cPanel is a Unix based web hosting control panel that provides a graphical interface and automation tools designed to simplify the process of hosting a web site. cPanel utilizes a 3 tier structure that provides functionality for administrators, rese…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

815 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now