Jump to content

Recommended Posts

Posted

Hi everyone, I'm after a little confirmation that I do things in a sensible way! The longest part of the login script is the time it takes to add the printers. This is how we do it:

 

A System variable is set on each machine, called Location, and this helps determine which printer to set as the default. The script 'printers.bat', called in the login.bat script, contains the following:

 

IF %Location% == upstairs CON2PRT /CD \\SERVER\UpperSchool_HP

IF %Location% == upstairs CON2PRT /C \\SERVER\LowerSchool_HP

IF %Location% == upstairs CON2PRT /C \\SERVER\"ICT_Suite_HP_3600"

IF %Location% == upstairs CON2PRT /C \\SERVER\"New_Build_Upper_School"

IF %Location% == upstairs CON2PRT /C \\SERVER\"New_Build_Lower_School"

plus 2 other printers :)

 

Is this an efficient way to do it??

 

Thanks for your help.

Posted

what you might try is

 

if %locaion% == upstairs call upstairs.bat
goto eof
if %location% == downstars call downstairs.bat
goto eof

 

 

etc etc. This way you can setup the whole mapping of printers in a file and have it just a bit more organized.

  • Thanks 1
Posted

Cool, thanks. Out of all the things in the logon script, the printer bits take the longest.

 

Do you think the line

 

IF %Location% == upstairs CON2PRT /CD \\SERVER\UpperSchool_HP

 

Will actually try and check the UpperSchool printer over the network? If so, it means that several printers will be checked during each login, slowing things down.

 

We have Win2k still, until next A pril.

Posted
I haven't played with CON2PRT too much, but if it works like a normal network printer map, it will not only connect, but download and install the print drivers to the workstation. The good news with this after the first login it won't take so long as the network printers are already connected for the same user.
  • Thanks 1
Posted
I haven't played with CON2PRT too much, but if it works like a normal network printer map, it will not only connect, but download and install the print drivers to the workstation. The good news with this after the first login it won't take so long as the network printers are already connected for the same user.

 

I take it the printer drivers are only downloaded if they aren't available? Presumably it doesn't do download each time?

 

Also, we have roaming mandatory profiles- would this make any difference? Is there a way I can stop the drivers being downloaded?

 

So many questions!

Posted

Drivers are per PC. If the PC already has it, it will not need to download it each time. It would just connect to the printer.

I don't know of a way to make sure the drivers aren't connected. But if the PC doesn't know how to talk to the printer, when you try to print you'll get gibberish.

Posted

Hi

 

I had a few problems with some machines and had to added the following at the start of the script

 

\\server\NETLOGON\CON2PRT /F

 

This wipes the printers off the machine and then they get reinstalled every time. I had a problem where I had a bad driver of some machines and it was not updating from the one on the print server.

 

I also had to put a copy of the con2prt in my netlogon and had to put the path to in in the script.

 

Richard

Posted

I use VBS scripts that map by OU (linked to location)... used the GPO deployment once... found no setting for default printers then went straight back to scripts :rolleyes:

 

That's a useful switch for the CON2PRT, does it just delete the printers or does it kill the drivers as well, cleanspl style?

Posted
Just on kind of the same topic, does anyone know how to delete the XPS printer each time someone logs on?

 

This is what I do to remove network printers. You can probably modify it for your printer

 

cscript %systemroot%\system32\prnmngr.vbs -d -p \\server\HPLJ

Posted

Hey Ricki,

Here is what I use

I put this in the login script to call the vbs file

 

cscript \\serverexch\NETLOGON\printer.vbs //B

 

In my printer.vbs file I have the following:

 

Option Explicit
Dim objNetwork, strPrinter1,strPrinter2,strPrinter3

strPrinter1 = "\\Server\Brother"
strPrinter2 = "\\Server\HPLJ1"
strPrinter3 = "\\Server\HPLJ2"

Set objNetwork = CreateObject("WScript.Network") 
objNetwork.AddWindowsPrinterConnection strPrinter1
objNetwork.AddWindowsPrinterConnection strPrinter2
objNetwork.AddWindowsPrinterConnection strPrinter3

WScript.Quit

 

Seems to work pretty good for me.

Posted
Just on kind of the same topic, does anyone know how to delete the XPS printer each time someone logs on?

 

This is a VBS script which runs at logon I use to remove:

 

Microsoft Office Document Image Writer

Microsoft XPS Document Writer

Send To OneNote 2007

 

The script:

 

strComputer = "."

Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colInstalledPrinters = objWMIService.ExecQuery ("SELECT * FROM Win32_Printer")

For Each objPrinter in colInstalledPrinters

IF objPrinter.Name = "Microsoft Office Document Image Writer" THEN

objPrinter.Delete_

ELSEIF objPrinter.Name = "Microsoft XPS Document Writer" THEN

objPrinter.Delete_

ELSEIF objPrinter.Name = "Send To OneNote 2007" THEN

objPrinter.Delete_

END IF

Next

 

Hope this helps.

  • Thanks 4
Posted
on error resume next
Dim 		objNetwork, compName

Set objNetwork 	= 	CreateObject("WScript.Network")
compName	=	lCase(left(objNetwork.ComputerName,3))
if compName = "lap" then compname = lCase(left(objNetwork.ComputerName,7))


Select Case compName

Case "lib"
	nukePrinters
	objNetwork.AddWindowsPrinterConnection "\\printserver1\Library HP CP2020"
	objNetwork.SetDefaultPrinter "\\printserver1\Library HP CP2020"

Case "sp-"
	objNetwork.AddWindowsPrinterConnection "\\printserver2\Kyocera TASKalfa 250ci"
	objNetwork.SetDefaultPrinter "\\printserver2\Kyocera TASKalfa 250ci"

Case "lap-ent","lap_ent"
	nukePrinters
	objNetwork.AddWindowsPrinterConnection "\\daisy\e1"
	objNetwork.AddWindowsPrinterConnection "\\printserver1\e2-2600"
	objNetwork.AddWindowsPrinterConnection "\\printserver1\e3-cp2020"
	objNetwork.SetDefaultPrinter "\\printserver1\e3-CP2020"

Case "lap-hum","lap_hum"
	nukePrinters

Case "lap-mfl","lap_mfl"
	nukePrinters

End Select


function nukePrinters
strComputer = "."

Set WshNetwork = WScript.CreateObject("WScript.Network")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colInstalledPrinters = objWMIService.ExecQuery("Select * from Win32_Printer")
For Each objPrinter in colInstalledPrinters
if InStr(objPrinter.Name, "\\") > 0 then 
WshNetwork.RemovePrinterConnection objPrinter.Name
end if 
Next

end function

  • 4 months later...
Posted
This is a VBS script which runs at logon I use to remove:

 

Microsoft Office Document Image Writer

Microsoft XPS Document Writer

Send To OneNote 2007

 

The script:

 

 

 

Hope this helps.

 

I tried this and it works fine if I run it logged on as an admin, but if I call it to run during the logon scripts I get a premission denie error.

Can anyone suggest how I can change the permissions to let the script run, it's pointing to line 8 of the script!

 

Thanks

Posted

I deploy printers per user, per computer or a combination of both using 2003 R2 Print Management.

 

As for setting up the default printer I use a reg file at logon to set the default:

 

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows]
"Device"="\\\\SERVERNAME\\PRINTER-NAME,winspool,Ne03:"

 

The easiest way is to set a printer as default, then navigate to HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows within the registry and export the entries, then save the reg file within your NETLOGON share and update logon scripts accordingly.

Posted

recently ive started deploying with the 2003 r2 method and deploying printers to a policy then assigning that to the appropriate ou or using filtering and applying it to a group then adding a login script running pushprinterconnection to xp pcs. To set the default i use a heavily cut down version of my old vbs script that just sets the dfault printer (sets it once as network printer then tries to set it as local printer and all my local printers are called local printer)

 

' Printers.vbs - Jonathan
Option Explicit
Dim objNetwork
on error resume next

Set objNetwork = CreateObject("WScript.Network") 
objNetwork.SetDefaultPrinter "\\server\Laser1"
objNetwork.SetDefaultPrinter "local printer"

 

i just copy a shortcut to that vbs scrpit to %allusersprofile%\start menu\programs\startup\printers.lnk and as i always copy it with a name specified if i move it to a new ou it will copy say suite.lnk or ks1.lnk as printers overwriting the old one. On older deployments i just did the vbs

objNetwork.SetDefaultPrinter "local printer"

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...