Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with printer problem

Status
Not open for further replies.

UglyDogNH

IS-IT--Management
Jul 11, 2011
21
US
Can anyone let me know if it is possible to select a printer tray in a script? I have a simple script but one of the printer’s trays needs to be established. Here is my script

Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection "\\SERVER\Pod4"
WshNetwork.AddWindowsPrinterConnection "\\SERVER\Pod4Super"
WshNetwork.SetDefaultPrinter \\SERVER\Pod4

How do I send the job sent to Pod4Super to TRAY 2?

Thanks in advance.
 
You might be able to do it at the application level through an application object (word, excel). I doubt you can control these properties at the server level.

-Geates

"I hope I can feel and see the change - stop the bleed inside a feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
Doing it in Word is not an option. The print jobs come from 3rd party apps too. On the network I have the same printer setup twice, each using a different tray. If our workstations were setup with the correct permissions and everyone was not an administrator my printers would work perfectly.
I use scripts to install printers for each user on the machines but I have to go around and change that 1 setting to switch the tray. I’m open to solutions.
Thanks
 
So, because you have two logically printers configured to use different trays on the same physical printer, couldn't you make certain users members of certain groups and install printers based on who is logged in?

Code:
set objADSysinfo = CreateObject("ADSystemInfo")
set objUser      = GetObject("LDAP://" & objADSysinfo.UserName & "")

boolTray2 = false
for each objGroup in objUser.Groups
    if (objGroup.CN = "Tray2") then boolTray2 = true
next

if (boolTray2) then
   objNetwork.AddWindowsPrinterConnection "\\server\tray2"
else
   objNetwork.AddWindowsPrinterConnection "\\server\tray1"    
end if

-Geates

"I hope I can feel and see the change - stop the bleed inside a feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
This probably works. But as you can see my scripts are very simple and I’m not sure what I need to do to modify yours to get mine to work. I’ve tried several things, unsuccessfully.

Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection "\\SERVER\Pod4"
WshNetwork.AddWindowsPrinterConnection "\\SERVER\Pod4Super"
WshNetwork.SetDefaultPrinter \\SERVER\Pod4

Could you please give me some details?
Thanks
 
What are the printer names of the two logical printers? Your profile says you are in IT management. I would assume your environment is using AD and know how to create AD groups? Create a group with those that print to the printer configured with tray 2. What did you name the group?

-Geates


"I hope I can feel and see the change - stop the bleed inside a feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
That would work except everyone has administrative privileges to their local machines which screws up many of the things you set from the server. Printer rights and permissions is one of them. I inherited this system. I don’t like it and I may get my way to change what needs to be changed someday. But not today.
 
Wow, I hope so! I bet the desktop team is constantly batteling spy/mal -ware and viruses.

You may want to want to remove all the printers first and then re-add them. If the printer already exists on the local machine, the addition is bypassed and the client never gets server settings.

Printers are easy to remove from the list but a ghost copy still exists in the registry (both local machine and user registries). It was so bad in our environment when going from a 2000 print server to a NEW 2003 print server that I wrote a printerScrubber.vbs which is used daily by the desktop team to fix printer issue. It tweaks the registry so use it cautiously!

NOTE: Bare in mind that Word documents ALSO contain a ghost copy of the printers AT THE TIME IT WAS SAVED!! If printer problems still exists from word documents, copy the content from the document and paste it in a new document.

-Geates



"I hope I can feel and see the change - stop the bleed inside a feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top