+ Post New Thread
Results 1 to 4 of 4
Windows Server 2000/2003 Thread, Printers not mapping correctly??? in Technical; I have a printer in each computer lab which are set via the logon script. Lately however they have not ...
  1. #1
    actech's Avatar
    Join Date
    Mar 2008
    Location
    Australia
    Posts
    198
    Thank Post
    50
    Thanked 20 Times in 17 Posts
    Rep Power
    16

    Printers not mapping correctly???

    I have a printer in each computer lab which are set via the logon script. Lately however they have not always been going right. Sometimes random computers are mapping to a single printer in one room. Nothing has changed in the script, and it seems to be random.

    Would it be better to map the via GPO?? How much does this take?

    For reference here is an example of the script
    Code:
    ' Create printers for computers in Room 214
    cmp = InStr( 1, strComputerName, "ACW-214", 1)
    If cmp > 0 Then
        objNet.RemovePrinterConnection ( "\\Sun\HP1200-102" ) , true, true
        objNet.AddWindowsPrinterConnection( "\\Sun\HP1200-214" )
        objNet.SetDefaultPrinter( "\\Sun\HP1200-214" )
        WScript.Quit
    End If

  2. #2
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,791
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    118
    I'd need to see the whole script... as it stands that nugget just stops when it finds the right printer and has added it.

  3. #3
    actech's Avatar
    Join Date
    Mar 2008
    Location
    Australia
    Posts
    198
    Thank Post
    50
    Thanked 20 Times in 17 Posts
    Rep Power
    16
    This is the whole section of the script that maps the printers. The section above is not for the first printer, which makes it a not more confusing for me. I am not overly converse with vb but know enough to get around.

    Code:
    blnLocal = FALSE
    strComputer = "."
    
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set colPrinters = objWMIService.ExecQuery("Select * From Win32_Printer")
         
    For Each objPrinter in colPrinters
        If objPrinter.Attributes And 64 Then 
            blnLocal = TRUE
        End If
    Next
    
    
    If blnLocal = FALSE Then
    
    ' Variables declaration
    Dim objNet, strComputerName, cmp
    
    
    ' Read NetBIOS computer name
    Set objNet = WScript.CreateObject( "WScript.Network" )
    strComputerName = objNet.ComputerName
    
    'Remove obsolete Printers
    'objNet.RemovePrinterConnection ( "\\Sun\iR5200 - Admin" ) , true, true
    'objNet.RemovePrinterConnection ( "\\Sun\iR5200 - Admin" ) , true, true
    
    ' Create printers for computers in Staff Room
    cmp = InStr( 1, strComputerName, "ACW-STAFF", 1)
    If cmp > 0 Then
        objNet.AddWindowsPrinterConnection( "\\Sun\iR5200 - Admin" )
        objNet.AddWindowsPrinterConnection( "\\sun\HP2015n-Staff" )
    '    objNet.AddWindowsPrinterConnection( "\\Sun\T8024-Admin" )
    '    objNet.AddWindowsPrinterConnection( "\\sun\HP2015n-Admin" )
        objNet.SetDefaultPrinter( "\\sun\HP2015n-Staff" )
        WScript.Quit
    
    End If
    
    ' Create printers for computers on Staff Laptops
    cmp = InStr( 1, strComputerName, "ACW-LT", 1)
    If cmp > 0 Then
    '    objNet.AddWindowsPrinterConnection( "\\sun\HP2015n-Lib" )
        objNet.AddWindowsPrinterConnection( "\\Sun\HP1200-214" )
        objNet.AddWindowsPrinterConnection( "\\Sun\HP1200-102" )
        objNet.AddWindowsPrinterConnection( "\\Sun\iR5200 - Admin" )
        objNet.AddWindowsPrinterConnection( "\\sun\HP2015n-Staff" )
    '    objNet.AddWindowsPrinterConnection( "\\sun\HP2015n-Admin" )
    '    objNet.AddWindowsPrinterConnection( "\\Sun\T8024-Admin" )
        objNet.SetDefaultPrinter( "\\sun\HP2015n-Staff" )
        WScript.Quit
    
    End If
    
    ' Create printers for computers in Admin
    cmp = InStr( 1, strComputerName, "ACW-ADMIN", 1)
    If cmp > 0 Then
        objNet.AddWindowsPrinterConnection( "\\Sun\iR5200 - Admin" )
        objNet.AddWindowsPrinterConnection( "\\Sun\HP2015n-Staff" )
        objNet.AddWindowsPrinterConnection( "\\Sun\T8024-Admin" )
        objNet.AddWindowsPrinterConnection( "\\sun\HP2015n-Admin" )
    '    objNet.AddWindowsPrinterConnection( "\\sun\Ky1800-DP" )
    '    objNet.SetDefaultPrinter( "\\sun\HP2015n-Admin" )
        WScript.Quit
    End If
    
    ' Create printers for computers in Room 102
    cmp = InStr( 1, strComputerName, "ACW-102", 1)
    If cmp > 0 Then
        objNet.AddWindowsPrinterConnection( "\\Sun\HP1200-102" )
        objNet.SetDefaultPrinter( "\\Sun\HP1200-102" )
        WScript.Quit
    End If
    
    ' Create printers for computers in Room 214
    cmp = InStr( 1, strComputerName, "ACW-214", 1)
    If cmp > 0 Then
        objNet.RemovePrinterConnection ( "\\Sun\HP1200-102" ) , true, true
        objNet.AddWindowsPrinterConnection( "\\Sun\HP1200-214" )
        objNet.SetDefaultPrinter( "\\Sun\HP1200-214" )
        WScript.Quit
    End If
    
    ' Create printers for computers in Room 215
    cmp = InStr( 1, strComputerName, "ACW-215", 1)
    If cmp > 0 Then
        objNet.RemovePrinterConnection ( "\\Sun\HP1200-102" ) , true, true
        objNet.AddWindowsPrinterConnection( "\\Sun\HP2015n-215" )
        objNet.SetDefaultPrinter( "\\Sun\HP2015n-215" )
        WScript.Quit
    End If
    
    ' Create printers for computers in Library
    cmp = InStr( 1, strComputerName, "ACW-LIB", 1)
    If cmp > 0 Then
        objNet.RemovePrinterConnection ( "\\Sun\HP1200-102" ) , true, true
        objNet.AddWindowsPrinterConnection( "\\sun\HP2015n-Lib" )
        objNet.SetDefaultPrinter( "\\sun\HP2015n-Lib" )
        WScript.Quit
    End If
    
    ' Create printers for computers in Bookhire
    'cmp = InStr( 1, strComputerName, "ACW-Bookhire", 1)
    'If cmp > 0 Then
    '    objNet.AddWindowsPrinterConnection( "\\Sun\Ky1800-Lib" )
    '    objNet.SetDefaultPrinter( "\\Sun\Ky1800-Lib" )
    '    WScript.Quit
    'End If
    
    ' Create printers for computers in Room 211
    cmp = InStr( 1, strComputerName, "ACW-211", 1)
    If cmp > 0 Then
        objNet.AddWindowsPrinterConnection( "\\Sun\HP1200-214" )
        objNet.SetDefaultPrinter( "\\Sun\HP1200-214" )
        WScript.Quit
    
    End If
    
    End If

  4. #4
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,791
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    118
    In terms of the script, this line stands out
    Code:
    If objPrinter.Attributes And 64 Then
    No idea what the And 64 bit is all about.

    As for the rest, have you checked that the printer spooler on //SUN is running correctly... I've found that problems in that regard can give the impression that the script is at fault when it's actually the spooler.

    Also, have you changed anything in GPO to make script run asynchronously such that another script is using most of the timeout capacity, causing your script to stop early.




    Oooh, completely forgot... Have you got this in your code?

    Code:
    On error resume next
    You may find that a missing printer is causing the script to terminate early.

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 23
    Last Post: 13th November 2013, 01:29 PM
  2. mapping printers via .vbs & GPO
    By techie211 in forum Windows Server 2000/2003
    Replies: 16
    Last Post: 12th June 2009, 09:46 AM
  3. Citrix not mapping client printers
    By Andi in forum Thin Client and Virtual Machines
    Replies: 0
    Last Post: 7th November 2008, 12:02 PM
  4. [CLOSED] Bug/Error: Signature not displaying correctly
    By kearton in forum EduGeek.net Site Problems
    Replies: 2
    Last Post: 9th January 2008, 09:20 AM
  5. Mapping Printers based on Location
    By NeoNemesis in forum Windows
    Replies: 11
    Last Post: 6th August 2007, 08:03 AM

Thread Information

Users Browsing this Thread

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

Posting Permissions

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