+ Post New Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 23
Windows Thread, printers and login scripts in Technical; Hi everyone, I'm after a little confirmation that I do things in a sensible way! The longest part of the ...
  1. #1
    rocknrollstar's Avatar
    Join Date
    Jun 2008
    Location
    Hampshire
    Posts
    410
    Thank Post
    367
    Thanked 28 Times in 24 Posts
    Rep Power
    15

    printers and login scripts

    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.

  2. #2

    Join Date
    Nov 2005
    Location
    North
    Posts
    1,189
    Thank Post
    18
    Thanked 52 Times in 39 Posts
    Rep Power
    25
    Seems an okay way to do it, currently we use 2003 R2 which lets you deploy printers via group policy to rooms which is much easier.

  3. Thanks to Simcfc73 from:

    rocknrollstar (27th November 2009)

  4. #3

    Join Date
    Nov 2009
    Posts
    54
    Thank Post
    3
    Thanked 12 Times in 12 Posts
    Rep Power
    7
    what you might try is

    Code:
    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.

  5. Thanks to Nixphoe from:

    rocknrollstar (27th November 2009)

  6. #4

    Join Date
    Nov 2009
    Posts
    54
    Thank Post
    3
    Thanked 12 Times in 12 Posts
    Rep Power
    7
    Code:
    call %location%.bat

  7. Thanks to Nixphoe from:

    rocknrollstar (27th November 2009)

  8. #5
    rocknrollstar's Avatar
    Join Date
    Jun 2008
    Location
    Hampshire
    Posts
    410
    Thank Post
    367
    Thanked 28 Times in 24 Posts
    Rep Power
    15
    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.

  9. #6

    Join Date
    Nov 2009
    Posts
    54
    Thank Post
    3
    Thanked 12 Times in 12 Posts
    Rep Power
    7
    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.

  10. Thanks to Nixphoe from:

    rocknrollstar (29th November 2009)

  11. #7
    rocknrollstar's Avatar
    Join Date
    Jun 2008
    Location
    Hampshire
    Posts
    410
    Thank Post
    367
    Thanked 28 Times in 24 Posts
    Rep Power
    15
    Quote Originally Posted by Nixphoe View Post
    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!

  12. #8

    Join Date
    Nov 2009
    Posts
    54
    Thank Post
    3
    Thanked 12 Times in 12 Posts
    Rep Power
    7
    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.

  13. #9
    ricki's Avatar
    Join Date
    Jul 2005
    Location
    uk
    Posts
    1,155
    Thank Post
    16
    Thanked 118 Times in 115 Posts
    Rep Power
    39
    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

  14. #10
    gshaw's Avatar
    Join Date
    Sep 2007
    Location
    Essex
    Posts
    1,765
    Thank Post
    91
    Thanked 130 Times in 121 Posts
    Rep Power
    45
    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

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

  15. #11
    zag
    zag is offline
    zag's Avatar
    Join Date
    Mar 2007
    Location
    Reading, UK
    Posts
    1,837
    Blog Entries
    10
    Thank Post
    198
    Thanked 147 Times in 124 Posts
    Rep Power
    32
    Just on kind of the same topic, does anyone know how to delete the XPS printer each time someone logs on?

  16. #12

    Join Date
    Nov 2009
    Posts
    54
    Thank Post
    3
    Thanked 12 Times in 12 Posts
    Rep Power
    7
    Quote Originally Posted by ittech View Post
    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

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

  17. #13

    Join Date
    Nov 2009
    Posts
    54
    Thank Post
    3
    Thanked 12 Times in 12 Posts
    Rep Power
    7
    Hey Ricki,
    Here is what I use
    I put this in the login script to call the vbs file

    Code:
    cscript \\serverexch\NETLOGON\printer.vbs //B
    In my printer.vbs file I have the following:

    Code:
    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.

  18. #14

    plexer's Avatar
    Join Date
    Dec 2005
    Location
    Norfolk
    Posts
    8,924
    Thank Post
    276
    Thanked 795 Times in 715 Posts
    Rep Power
    188
    If you are using vbs why not just add it as a login script in a gpo?

    Ben

  19. #15

    DaveP's Avatar
    Join Date
    Oct 2006
    Location
    Can't talk now: The mother-ship is calling!
    Posts
    4,486
    Blog Entries
    1
    Thank Post
    168
    Thanked 663 Times in 419 Posts
    Rep Power
    511
    Quote Originally Posted by ittech View Post
    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.

  20. 4 Thanks to DaveP:

    Alis_Klar (25th April 2010), CheeseDog (28th January 2010), reggiep (22nd April 2010), zag (1st December 2009)

SHARE:
+ Post New Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 3
    Last Post: 8th November 2011, 01:42 PM
  2. Printers disappearing after login script
    By gshaw in forum Windows
    Replies: 11
    Last Post: 10th June 2009, 06:47 PM
  3. login scripts
    By palmer_eldritch in forum Mac
    Replies: 1
    Last Post: 6th March 2008, 11:47 AM
  4. Replies: 7
    Last Post: 20th December 2007, 04:45 PM
  5. Problem with Home Drive and login scripts
    By ArchersIT in forum Windows
    Replies: 4
    Last Post: 11th July 2007, 12:17 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •