• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 847
  • Last Modified:

Adding and configuring a Printer Via VBSCRIPT

I have an HP Laserjet M603 - I can install the envelope feeder manually I was wondering if I can configure the machines using a VBS script? The drivers are pre-installed on all the machines all I need to do is the feeder. My steps are..

Go to Printer preferences and setup an envelope shortcut, which configures the paper size, destination, paper type and configures duplexing to NO.

Thanks in advance for your assistance!
0
Edward Pamias
Asked:
Edward Pamias
  • 5
  • 4
1 Solution
 
Michael PfisterCommented:
These are the standard tools for printer management available under Windows XP:
http://www.techrepublic.com/article/dont-overlook-these-windows-xp-vbscript-print-utilities/5030819

They won't allow you to set the envelope feeder option, but I wonder why the driver doesn't pick up the printer options automatically?
0
 
Michael PfisterCommented:
http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_24304222.html

The options are placed in a binray setting value depending on your printer model. You can use the above VBS to read them.
0
 
Edward PamiasAuthor Commented:
I get an error when I use that script. I attached the screen shot. I also attached the VB Script from the link in the previous post.
script-error.bmp
ptrscript.vbs
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
Michael PfisterCommented:
It seems the script from the link is just a snippet from a larger script. I believe this is missing:

strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ 
strComputer & "\root\default:StdRegProv")

Open in new window


Still you'll need some other ocde to add the values read to another computer...
0
 
Edward PamiasAuthor Commented:
I added that and got an errr line 17 character 1.



strComputer = "IBM-803EBB82008"
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")

Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
 
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\Generic / Text Only\PrinterDriverData"
strValueName = "TTY DeviceConfig"
 
oReg.GetBinaryValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,arrValues
 
count = 0
 
wstmp = "PrinterDeviceConfig=array("
For Each strValue In arrValues
 
      if count = 0 then  wstmp = wstmp & strValue
      if count <> 0 then  wstmp = wstmp & "," & strValue
 
      count = count + 1
Next
 
wstmp = wstmp & ")"
Wscript.Echo "Array " & wstmp
0
 
Michael PfisterCommented:
You need to adjust

strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\Generic / Text Only\PrinterDriverData"

and

strValueName = "TTY DeviceConfig"

according to your printer.
0
 
Edward PamiasAuthor Commented:
I got another error... how about this... my printer is HP LaserJet Professional M1530 MFP Series  -- where do I put this in the script?
0
 
Michael PfisterCommented:
You have to look into the registry under the key HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers how your printer is named there. ..

It could be \HP LaserJet M1530 MFP Series PCL 6, so

strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\HP LaserJet M1530 MFP Series PCL 6\PrinterDriverData"

Sorry, I don't know which value is controlling the paper tray and so on... it all depends on the printer driver... the example is for the generic text printer....
0
 
Edward PamiasAuthor Commented:
Thank you!
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now