View Full Version : Windows batch file shared printer remote install?
10th September 2003, 03:47 AM
I have several printers shared from an NT print server. Users connect to the shared printers using NT and 2K machines. Recently I had to move the printers to a different machine, then send out email explaining how to delete and reinstall the printers.
Now I have moved the printers back (it's a long story, but before the evangelists jump in, Linux wouldn't have helped here). Since users are largely incompetent monkeys and liars who can't follow basic instructions, I thought it'd be good to install the network printers from a batch file. Any old monkey can run a batch file.
Anyone know how to do this?
I found some information using rundll, but nothing specific about shared network printers.
10th September 2003, 05:37 PM
Hmph! No win32 batch experts here, then? Or is it not possible. I've got a botch job running with a vbs file, but it's a bit shaky.
11th September 2003, 02:32 AM
The Con2prt.exe tool is a command-line utility for adding or removing network printers on Windows NT-based computers.
This tool can only configure NT based computers. A different method for Win2K computers is listed after the NT instructions.
Con2prt.exe is included with the Zero Administration Kit for Windows NT 4.0.
You can use the Con2prt.exe tool in a Windows NT login script or in conjunction with an unattended setup of Windows NT.
To install a network printer with the Con2prt.exe tool, you can either:
Run the Con2prt.exe Tool from a Login Script-
Use the Con2prt.exe tool to connect to a network printer in a Windows NT login script. To do so, follow these steps:
Copy the Con2prt.exe tool to the %SystemRoot% folder of the Windows NT-based client computer.
Configure your Windows NT login script to run the Con2prt.exe tool.
NOTE: You can display the command-line switches for the Con2prt.exe tool by typing "con2prt /?" or "con2prt /h" (without quotation marks).
Or run the Con2prt.exe Tool from a Batch File on the Distribution Share-
Use a batch file located in the $$ folder of your Windows NT Setup distribution share to run the Con2prt.exe tool.
You can automate the installation of the batch file with the tools used for an unattended installation of Windows NT.
To do so, follow these steps:
Copy the Con2prt.exe file to the $$ folder that is located in the $OEM$ folder of your Windows NT Setup distribution share.
Create a batch file in the $$ folder that runs the Con2prt.exe tool.
NOTE: Files located in the $$ folder of the distribution share are copied to the %SystemRoot% folder of the Windows NT-based client computer during Windows NT Setup.
Confirm that your Unattend.txt file contains the following entry in the [unattended] section:
OEMPreInstall = yes
Configure your Cmdlines.txt file to run a registry file that places the command to run your batch file in the Run key of the registry on the Windows NT-based client computer.
NOTE: You cannot run the Con2prt.exe tool directly from the Cmdlines.txt file.
For W2000 clients printing from an NT server:
This command only runs on a Windows 2000 computer against a Windows 2000 or a Windows NT 4.0 server or workstation.
This example adds an Agfa printer driver and creates a logical printer on a computer named SERVER.
NOTE: Both lines can be placed in a batch file or typed after each other at a command prompt. These two lines are wrapped for readability.
rundll32 printui.dll,PrintUIEntry /ia /c\\server /m "AGFA-AccuSet v52.3" /h "Intel" /v "Windows 2000" /f %windir%\inf\ntprint.inf
rundll32 printui.dll,PrintUIEntry /if /b "Test printer" /c\\SERVER /f "%windir%\inf\ntprint.inf" /r "lpt1:" /m "AGFA-AccuSet v52.3"
This example deletes an AGFA printer on a computer named SERVER:
rundll32 printui.dll,PrintUIEntry /dl /b "Test Printer" /c\\SERVER
For more information about the available switches, type /? after the command.
In addition, at a command prompt, type:
rundll32 printui.dll,PrintUIEntry /?
The preceding command displays the entire list of usage switches with extensive examples for using this method.
If this is of any help, good luck. Otherwise, good luck.
© 2001-2009, James Randi Educational Foundation. All Rights Reserved.
vBulletin® v3.7.7, Copyright ©2000-2013, Jelsoft Enterprises Ltd.