#157947 - 2006-02-28 01:28 PM
Add new printer
|
JohnLennon
Fresh Scripter
Registered: 2006-02-28
Posts: 5
|
Instead of move a printer (wich i found on these forums) i'm looking for a script to add a new printer includes the driver. Also with possibility to configure the settings. Can anyone help me ? I looked everywhere, but even in the usermanuel i can't find the solution.
ps.
i want to add this script for my RIS installation (unattended for winXP)
|
Top
|
|
|
|
#157949 - 2006-02-28 01:57 PM
Re: Add new printer
|
JohnLennon
Fresh Scripter
Registered: 2006-02-28
Posts: 5
|
It is a networkprinter. If i use addprinterconnection() how can i link it to his IP ?
|
Top
|
|
|
|
#157951 - 2006-02-28 02:07 PM
Re: Add new printer
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
Hi JohnLennon and welcome to korg, Not sure if this is what you are looking for but maybe it’s a start. For these functions to work you must have the printer drivers already installed.
Code:
$OperatingSystem = @PRODUCTTYPE AddPrinter("\\ServerName\PrinterShareName") SetDefPrinter("\\ServerName\PrinterShareName") Function AddPrinter($PrinterLocation) If InStr($OperatingSystem,"Server") $WshNetwork = CreateObject("WScript.Network") $WshNetwork.AddWindowsPrinterConnection($PrinterLocation) Else $= AddPrinterConnection($PrinterLocation) EndIf EndFunction Function SetDefPrinter($PrinterLocation) If InStr($OperatingSystem,"Server") $WshNetwork = CreateObject("WScript.Network") $WshNetwork.SetDefaultPrinter($PrinterLocation) Else $= SetDefaultPrinter($PrinterLocation) EndIf EndFunction
|
Top
|
|
|
|
#157953 - 2006-02-28 02:25 PM
Re: Add new printer
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
JohnLennon, Jooel will be a much better guide for you and will be able to give you better advice.
Edited by benny69 (2006-02-28 02:26 PM)
|
Top
|
|
|
|
#157954 - 2006-02-28 02:36 PM
Re: Add new printer
|
JohnLennon
Fresh Scripter
Registered: 2006-02-28
Posts: 5
|
Jooel, if i look at the script (from Allen) i see the green text, but what must i change to config it to my personal settings ?
This line: $=WriteValue($IPPrinterKey,"IPAddress","$Port","REG_SZ")
or: ; IPAddress (xxx.xxx.xxx.xxx)
|
Top
|
|
|
|
#157956 - 2006-02-28 03:15 PM
Re: Add new printer
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
|
Top
|
|
|
|
#157957 - 2006-03-01 10:07 AM
Re: Add new printer
|
JohnLennon
Fresh Scripter
Registered: 2006-02-28
Posts: 5
|
The lines after the ";" symbol doesn't count ?
|
Top
|
|
|
|
#157959 - 2006-03-01 12:53 PM
Re: Add new printer
|
JohnLennon
Fresh Scripter
Registered: 2006-02-28
Posts: 5
|
o.k. so it doesn't matter if i delete those lines
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 248 anonymous users online.
|
|
|