Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

URGENT!!! User Logon Scripts for Printers 4

Status
Not open for further replies.

Stevehewitt

IS-IT--Management
Jun 7, 2001
2,075
GB
Hey,

I know how you run a batch script for time and dirve mappings, but what about a printer mapping?

I have a unc for 2 printers:

\\starblazer\general
\\starblazer\invoice

I assume you use the NET USE command but thats all I know! Please help, this is a major problem and very urgent.

Many thanks, Steve Hewitt
IT Administrator

Windows 2000 Microsoft Certified Professional (75 - 215)

 
Try this: net use lpt2 \\servername\printername. This will work assuming lpt2 is not a valid device name on the workstation.
 
If I type net use lpt2: \\starblazer\general it in manually, it said that the command was completed sucessfully, but its not in the printers folder. I have refreshed and used various ports.

What can I do?!

Cheers Steve Hewitt
IT Administrator

Windows 2000 Microsoft Certified Professional (75 - 215)

 
Steve,
once the command has completed, you should be able to connect to the printer normally, saying it is on lpt2 or wherever, then loading the printer drivers locally, as if the printer was plugged in the back of your PC....this should work ok.

Jon. :) ----------------------------------------
To be is to do (Sartre)
To do is to be (Casmus)
Do be do be do (Sinatra)
----------------------------------------
 
What you are looking for is rundll32 printui.dll, PrintUIEntry.

To create a nework connection to a printer named printer use this line in your script.

rundll32 printui.dll,PrintUIEntry /in /n\\server\printer /q

For a list of all switches type rundll32 printui.dll,PrintUIEntry /? at a command prompt.

This only works for 2000 or XP computers.

For more info see Kevin Mattson
MCP
 
Glad I could help. I have just recently started using this method to add specific printers for a few users. My long term goal is to set up security groups for each printer and then each user would have the appropriate printers installed based on the security group memberships. Kevin Mattson
MCP
 
Cool, that what I am starting to do. Suprised nobody else has told me that method! I owe you, your a life saver. Cheers. (P.S. I marked it as a helpful post!)

Again thanks Steve Hewitt
IT Administrator

Windows 2000 Microsoft Certified Professional (75 - 215)

 
Here is a way to set a printer up and set a default on in the logon script (vbscript)

' Create the object
Set WshNetwork = CreateObject("WScript.Network")

' Path to printer share
PrinterPath = "\\dcs-hermes\hq-ds-laserjet-2100"

' Printer driver name (look in ntprint.inf in winnt/
PrinterDriver = "HP LaserJet 2100"

' Add the printer
WshNetwork.AddWindowsPrinterConnection PrinterPath, PrinterDriver

' Set the default printer

Hope it is useful

James O'Kelly
Sr Web Developer
WshNetwork.SetDefaultPrinter "\\dcs-hermes\hq-ds-laserjet-2100"
 
Does anyone know how to use the rundll printui method to map a network printer AND set it as default. I tired the /y switch and it does not map the printer at all.

I am running the script from a windows 2000 GPO MACHINE startup script (NOT user logon) as I need different printers mapping for different rooms (The users move).

 
It looks like the /y option works on an existing print queue. Therefore you have to run the command twice, once without /y and then with /y. (ie Firstly to map the print queue and then to set it as default). Unless anyone knows otherwise...
 
Lovely.. I am using a Legacy DOS program (under NT5 DVM) and the 'NET USE' is ideal for this.
However, I still have to go round setting up system printers on each machine..

I'm definately into using your method, but will it still set up the virtual LPT ports, and if not, how will it react to the NET USE command?
Mixed Linux/Win2000 Network Administrator
 
Richgill,
I have tried using the command twice (second time using /y) . Still doesn't work, it says that the printer does not exist.

When I run the same command from dos once the user has logged in, it works ok so printer name is right.

I am now thinking I will have to use CON2PRT instead.




 
I'm experiencing the same challenge. The /y option only sets the default printer for the current user. I seriously need a way to define the default printer for all users on a particular machine.
 
I have used the program con2port before when scripting connections to Printers. It allows you to add multiple printers and set one as default. I believe it is part of the Winnt/Win2k Resource Kit.
-Sarekai
 
Hey,

I know this sounds daft to experienced users of Win2k, but where the bloody hell do I get my hands on the Win2k Resource Kit?

Cheers, Steve Hewitt
Systems Manager
 
Create a logon script (e.g. Kixtart) that reconnects to the printer at logon (or start it from a batchfile):

; ---- start of script ------
; Delete all printerconnections
DelTree("HKEY_CURRENT_USER\Printers\Connections")

; Resubmit the Connections key
AddKey("HKEY_CURRENT_USER\Printers\Connections")

; Add a new Windows Mapping
AddPrinterConnection("\\server\printer")

; DOS Mapping
USE "LPT1:" "\\server\printer"
; ---- end of script ------

This should do the job
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top