Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've got a login script setup, that removes all old printers, and then adds the current set of network printers.

CODE

Set WSHPrinters = WSHNetwork.EnumPrinterConnections
For LOOP_COUNTER = 0 To WSHPrinters.Count - 1 Step 2
  If Left(WSHPrinters.Item(LOOP_COUNTER +1),2) = "\\" Then
    WSHNetwork.RemovePrinterConnection WSHPrinters.Item(LOOP_COUNTER +1),True,True
  End If
Next

'Install Network Printers
WSHNetwork.AddWindowsPrinterConnection "\\SERVER\PRINTER1"
WSHNetwork.AddWindowsPrinterConnection "\\SERVER\PRINTER2"
WSHNetwork.AddWindowsPrinterConnection "\\SERVER\PRINTER3"
WSHNetwork.AddWindowsPrinterConnection "\\SERVER\PRINTER4"

This is fine, but seems to reset the current default printer on the users machine.

Is there a way to preserve the current default printer on the users machine?

Is this the most sensible way to confer network printers for users upon login? Or are there alternative or better ways to do so?

Any help is very much appreciated.

share|improve this question

3 Answers 3

up vote 0 down vote accepted

Last time I scripted that, I added a group for each printer in AD - then added the user to whatever printer group was suppose to be his or her default - and in the login script checked for this group membership, setting the appropriate default.

Obviously, that environment was pretty fixed so this was easy to determine - putting the burden on setting a default printer on the templates instead of the poor user (who could still temporarily change it manually when needed). A more obvious approach might be to check what the default printer is before removing the printers, and then (if that printer still exists after your script) re-apply the default printer setting.

But as TomTom writes, these days printers can be connected using group policies - and then you shouldn't experience any of your mentioned problems anyway.

I also recall doing a registry dump of the Printers registry key and then just importing it being stupendously fast, if you've got the possibility to freeze system configurations (like on a TS) it's quite fun, though not very maintainable ;)

share|improve this answer
    
I've since modified the login script itself to do exactly what you suggested. However, we have a number of users who have local printers that will be set as default, and presumably the login script will rejig these around. I've read that removing network printers and adding them again is a good practice because it prevents some problems with multiple SPOOLSS, but if there was a way to circumvent this seemingly arcane practice in login scripts, and manage it with GP I'd be very interested to hear about how to go about it, or be pointed in the right direction. –  spelk Mar 11 '10 at 12:49

Why use a script at all?

I roll out printer configurations (and mapped drives) using the client extensions of the group policy mechanism (that was introduced some long time ago and is part of all windows updates since years).

share|improve this answer
    
Can you be more specific? Can you please link to a guide? Thanks –  onesysadmin Mar 10 '10 at 9:44
    
    
Are the Client Side Extensions of GP only available through Windows Server 2008? We're running Windows Server 2003 SP2 at the moment. I'd be very interested in taking the setup of Printers and Drive mappings out of a login script and into some sort of formal Group Policy, but I haven't any clue how to do it, or where to start. –  spelk Mar 11 '10 at 12:44
    
They should be available in 2003 / XP. Separate downloads, though (as in: if your systems are fully patched, they should be there). –  TomTom Mar 11 '10 at 12:49

I use an old exe that came in the WinNT resource kit called con2prt.exe.

The best way to call it would be from your VBS login script as follows:

'Mapping printers needed by everyone
Set WSHShell = CreateObject("Wscript.Shell")
WSHShell.Run ("\\SERVER\SYSVOL\SERVER.local\scripts\map_printers.bat")

And the Map_Printers.bat should contain

:: Map Printers
: HP 1600
\\SERVER\SYSVOL\server.local\scripts\con2prt.exe /cd \\SERVER\HP1600
:: Ricoh Aficio 2035e 
\\SERVER\SYSVOL\server.local\scripts\con2prt.exe /c \\SERVER\RICOH2035
:: Samsung ML-2010
\\SERVER\SYSVOL\server.local\scripts\con2prt.exe /c \\SERVER\SamsML2010
:: HP BusinessInket 2230
\\SERVER\SYSVOL\server.local\scripts\con2prt.exe /c \\SERVER\HP2230

The /cd means set deafult.

You can find out all the commands by running con2prt.exe /?

Also - you can download here : http://www.paulmcgrath.net/download.php?view.2

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.