+ Reply to Thread
Page 2 of 2 FirstFirst 1 2
Results 16 to 23 of 23

Thread: printers and login scripts

  Share/Bookmark
  1. #16

    Reputation
    ChrisP's Avatar
    Join Date
    Apr 2007
    Location
    norfolk
    Posts
    150
    Thank Post
    4
    Thanked 6 Times in 6 Posts
    Rep Power
    8

    Default

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

  2. #17

    Reputation Reputation Reputation

    Join Date
    Nov 2005
    Location
    North
    Posts
    979
    Thank Post
    16
    Thanked 37 Times in 29 Posts
    Rep Power
    19

    Default

    Sort of related to this topic.

    Setting default printers is mentioned here.

    Just tried it on my 2003 domain and it works lovely... I just used a 2008 non DC server to do the preferences

    Set Default Printer with Windows 2008 Server Group Policy Preferences - Set the Default Printer via Group Policy | Windows Server Administration

  3. #18

    Reputation Reputation
    reggiep's Avatar
    Join Date
    Apr 2008
    Location
    Runcorn
    Posts
    721
    Thank Post
    169
    Thanked 19 Times in 19 Posts
    Rep Power
    11

    Default

    Quote Originally Posted by DaveP View Post
    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

  4. #19

    Reputation Reputation
    reggiep's Avatar
    Join Date
    Apr 2008
    Location
    Runcorn
    Posts
    721
    Thank Post
    169
    Thanked 19 Times in 19 Posts
    Rep Power
    11

    Default

    Doh,
    I put it in to the boot script and it worked fine.
    Thanks

  5. #20

    Reputation

    Join Date
    Jul 2008
    Location
    Merseyside
    Posts
    75
    Thank Post
    7
    Thanked 3 Times in 3 Posts
    Rep Power
    5

    Default

    Use group policy?

  6. #21

    Reputation Reputation Reputation Reputation
    browolf's Avatar
    Join Date
    Jun 2005
    Location
    Mars
    Posts
    1,151
    Blog Entries
    25
    Thank Post
    54
    Thanked 58 Times in 47 Posts
    Rep Power
    24

    Default

    an alternative

    rundll32 printui.dll,PrintUIEntry /in /n\\SERVERX\XMono

  7. #22

    Reputation
    Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation
    Michael's Avatar
    Join Date
    Dec 2005
    Location
    Birmingham
    Posts
    5,115
    Thank Post
    104
    Thanked 749 Times in 570 Posts
    Rep Power
    150

    Default

    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:

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

  8. #23

    Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation

    Join Date
    Mar 2009
    Location
    Doncaster/Leeds
    Posts
    1,339
    Thank Post
    51
    Thanked 183 Times in 166 Posts
    Rep Power
    48

    Default

    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)

    Code:
    ' 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"

+ Reply to Thread
Page 2 of 2 FirstFirst 1 2

Thread Information

Users Browsing this Thread

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

     

Similar Threads

  1. Printers disappearing after login script
    By gshaw in forum Windows
    Replies: 11
    Last Post: 10-06-2009, 06:47 PM
  2. Replies: 0
    Last Post: 18-08-2008, 11:23 AM
  3. login scripts
    By palmer_eldritch in forum Mac
    Replies: 1
    Last Post: 06-03-2008, 10:47 AM
  4. Replies: 7
    Last Post: 20-12-2007, 03:45 PM
  5. Problem with Home Drive and login scripts
    By ArchersIT in forum Windows
    Replies: 4
    Last Post: 11-07-2007, 12:17 PM

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