Re: a script to add a new printer



Hi,
I had the same problem and turned to the default vbs installed with XP
prndrvr.vbs, prnport.vbs, prnmngr.vbs, etc
You install first the port and the driver, then the printer itself.
if you need to change default page size you can use the Setprinter utility
(reskit 2003) or for updating the acls on the printer, use SetAcl.exe

Best thing is that you can do this remotely, since it's wmi !

Brgds

bruno

"Lasso" wrote:

> Thank you very very much.
> "Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@xxxxxxxxx>
> ??????:uqPUb32xFHA.1412@xxxxxxxxxxxxxxxxxxxxxxx
> > Lasso wrote:
> >
> >> Is there a script that can do the following task regarding printer
> >> installation
> >> 1.add a tcp/ip as local port, for example: 192.168.1.1
> >> 2.associate this port with specific pinter driver that located on a
> >> specific server on the network. For example: the printer driver file is
> >> stored on \\servername\foldername.
> >> 3. finish this printer installation and set this printer as default
> >> printer.
> >> Note: the scritp will run on windows xp.
> >>
> >>
> > Hi,
> >
> > I think an alternative is to use the prnadmin.dll that comes
> > with the MS Windows 2003 Server Resource Kit from a script.
> >
> >
> > Windows Server 2003 Resource Kit Tools
> > http://www.microsoft.com/downloads/details.aspx?FamilyID=9d467a69-57ff-4ae7-96ee-b18c4790cffd&DisplayLang=en
> >
> > (The kit will install on WinXP or later, but you can copy needed
> > files over to other computers, and then run regsvr32.exe against
> > prnadmin.dll)
> >
> >
> > More about PrnAdmin (from the RK help file):
> >
> > Printer Administration Objects (PrnAdmin) is a COM-based tool that
> > provides large-scale, noninteractive control of printers, drivers,
> > and ports on local and remote computers.
> >
> > Using PrnAdmin, you can:
> >
> > Add and delete a local or remote printer.
> > Add and delete printer connections.
> > Add and delete a local or remote form.
> > Add and delete a local or remote standard TCP/IP port (of type
> > Line Printer Remote (LPR) or RAW).
> > Add and delete a local or remote driver.
> > View a list of printers, ports, drivers, and forms on a local or
> > remote computer.
> > Control and configure a local or remote printer.
> >
> >
> > PrnAdmin consists of several scriptable COM objects residing in
> > Prnadmin.dll, which functions as a wrapper around Printui.dll.
> > Several Microsoft Visual Basic Script (VBScript) sample files are
> > included with the tool.
> >
> > Note
> >
> > For more detailed information on how to use PrnAdmin.DLL, see
> > Prnadmin.doc. This white paper provides additional information on
> > printer, drivers, ports and forms to help administrators and
> > programmers manage a large number of local and remote printers.
> >
> > Corresponding Operating System Features
> >
> > All the functionality of prnadmin.dll can be duplicated using the
> > printers folder and various wizards. Converting printer ports from
> > LPR to Standard TCP/IP is the only functionality in prnadmin.dll
> > for which there is no corresponding GUI.
> >
> > For more information about PrnAdmin and the Windows Management
> > Instrumentation (WMI) scripts in Windows Server 2003, see
> > Designing and Deploying Print
> > Servers(http://go.microsoft.com/fwlink/?LinkID=4745) in the
> > Windows Server 2003 Deployment Kit.
> >
> >
> > Files Required
> >
> > Prnadmin.dll
> >
> > The following sample VBScript files are also included:
> >
> > Prnadmin.doc
> > Clean.vbs
> > Clone.vbs (there is no WMI equivalent for the cloning script)
> > Conall.vbs
> > Defprn.vbs
> > Drvmgr.vbs
> > Forms.vbs
> > Persist.vbs
> > Portconv.vbs
> > Portmgr.vbs
> > Prncfg.vbs
> > Prnctrl.vbs
> > Prndata.vbs
> > Prnmgr.vbs
> >
> >
> > and
> >
> > HOW TO: Programmatically Create a Printer and Printer Port by
> > Using PrinterAdmin (Prnadmin.dll) with a Visual Basic Script
> > in Microsoft Windows 2000
> > http://support.microsoft.com/default.aspx?scid=kb;en-us;321025
> >
> >
> >
> >
> > --
> > torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
> > Administration scripting examples and an ONLINE version of
> > the 1328 page Scripting Guide:
> > http://www.microsoft.com/technet/scriptcenter/default.mspx
>
>
>
.



Relevant Pages

  • Re: Clustered printing issue
    ... tcp/ip port. ... accessible unless you install the printer driver. ... printers restored via the print migrator tool. ...
    (microsoft.public.windows.server.clustering)
  • Re: KMDF Fakemodem not working
    ... I'm using the `Windows Vista and Windows Server Longhorn x86 Checked Build ... install the fakemodem with devcon: ... INf in the sample should tell you how to use devcon to install the driver. ... Why do I need to choose a COM port? ...
    (microsoft.public.development.device.drivers)
  • KMDF Fakemodem not working
    ... I'm trying to develop my first device driver but have some problems getting ... I succeeded to install the WDM version on a Win 2003 Server x86 using the ... I had to disable a real modem driver, ... Why do I need to choose a COM port? ...
    (microsoft.public.development.device.drivers)
  • Re: [SLE] Missing 3D (was Compiz issues.)
    ... This is driver file location in above package ... post-uninstall script that will call tiny-nvidia-installer. ... Strange that it didn't offered to prepare existing kernel sources first. ... It can be that Smart did just what is programmed to do, install rpm, run ...
    (SuSE)
  • Re: NDIS WDM driver installation for multi-port NIC
    ... Windows 2k/XP/2k3 Filesystem and Driver Consulting ... miniport's inf and to install the miniport driver. ... the miniport driver (the bus driver starts up fine). ... identify the particular port you are communicating with. ...
    (microsoft.public.development.device.drivers)