+ 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
    435
    Thank Post
    387
    Thanked 28 Times in 24 Posts
    Rep Power
    20

    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,817
    Thank Post
    24
    Thanked 91 Times in 71 Posts
    Rep Power
    50
    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
    12
    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
    12
    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
    435
    Thank Post
    387
    Thanked 28 Times in 24 Posts
    Rep Power
    20
    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
    12
    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
    435
    Thank Post
    387
    Thanked 28 Times in 24 Posts
    Rep Power
    20
    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
    12
    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,475
    Thank Post
    20
    Thanked 164 Times in 157 Posts
    Rep Power
    52
    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
    2,650
    Thank Post
    164
    Thanked 217 Times in 200 Posts
    Rep Power
    66
    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
    Posts
    3,762
    Thank Post
    897
    Thanked 416 Times in 350 Posts
    Blog Entries
    12
    Rep Power
    86
    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
    12
    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
    12
    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
    13,328
    Thank Post
    622
    Thanked 1,577 Times in 1,414 Posts
    Rep Power
    413
    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
    8,775
    Thank Post
    351
    Thanked 1,274 Times in 870 Posts
    Blog Entries
    4
    Rep Power
    1126
    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: 23
    Last Post: 13th November 2013, 01:29 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, 10:47 AM
  4. Replies: 7
    Last Post: 20th December 2007, 03: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
  •