Login | |
|
 |
printer install once only - 7/2/2008 12:09:54 AM
|
|
 |
|
| |
aschwartz
Posts: 12
Score: 0
Joined: 4/30/2008
Status: offline
|
So we are looking to add a line to our login script that will add a printer driver and create a printer: rundll32 printui.dll,PrintUIEntry /if /b "Q Drive" /f %windir%\inf\ntprint.inf /r "lpt1:" /m "HP LaserJet 8000 Series PS" /z When you run this, it creates a printer using the HP LJ 8000 driver called the Q drive. It is used for doing a print to file to create a pdf. It works, I tried it, so I know I can script it too. My only problem, and being a newbie at scripting, is that I figure I only want it to run once, so I figure I could create a section in the lo9gin script just for this, and have it check for a file that I can create on the local C: drive and then if it exists not to run that portion, but if it doesnt, then to run the above line, and then create the file, so that it doesnt run again. Is this easily accomplished, or would it be easier to just check for the existance of the printer itself, and if it is there then to exit the script. I am unsure of how to proceed. Thanks in advance.
|
|
| |
|
|
|
 |
RE: printer install once only - 7/2/2008 4:27:28 AM
|
|
 |
|
| |
ebgreen
Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
|
Using EnumPrinterConnections would be a more scaleable solution. No what is linked is not VB. It is VBScript which is what this forum is here to help you write.
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: printer install once only - 7/2/2008 7:49:03 AM
|
|
 |
|
| |
ebgreen
Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
|
This is about as simple as the code gets: Set WshNetwork = WScript.CreateObject("WScript.Network") Set oDrives = WshNetwork.EnumNetworkDrives Set oPrinters = WshNetwork.EnumPrinterConnections WScript.Echo "Network drive mappings:" For i = 0 to oDrives.Count - 1 Step 2 WScript.Echo "Drive " & oDrives.Item(i) & " = " & oDrives.Item(i+1) Next WScript.Echo WScript.Echo "Network printer mappings:" For i = 0 to oPrinters.Count - 1 Step 2 WScript.Echo "Port " & oPrinters.Item(i) & " = " & oPrinters.Item(i+1) Next run it. See what it does. Understand what it does. Try to change it to meet your need. Post back here when you run into problems.
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
| |
|
|
 |
|
 |
|
|