Announcement

Collapse
No announcement yet.

2003 Domain Suppress Printer Errors

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 2003 Domain Suppress Printer Errors

    Hi All,
    I am wondering if someone can help me. I am using Windows 2003 Server in a domain environment. I am wanted to add an additional three printers to my logon script.

    The only problem is if the print servers attached to these printers are turned off when I log on I received a number of errors relating to how the printer mentioned in the logon script cannot be located.

    I was wondering if there is a switch (or something of the like) I can use to suppress such errors when I am logging in.

    The style of print server calling I have in my script is as follows:

    objNet.AddWindowsPrinterConnection "\\2003server\XYZ123"

    Thank you for your time.

    Cheers,
    Tony Crouch

  • #2
    Re: 2003 Domain Suppress Printer Errors

    What about

    Code:
    On Error Resume Next

    Comment


    • #3
      Re: 2003 Domain Suppress Printer Errors

      Hi Wullieb1,
      Thanks for your suggestion.

      I am just wanting to check how this command should be inserted ... I apologise for my nievity with server 2003 and VB scripting ... they definitely aren't my strong points.

      Something like ...

      'Map print server
      objNet.AddWindowsPrinterConnection "\\2003server\XYZ123"

      'If print server unavailable
      On Error Resume Next

      'Map another print server
      objNet.AddWindowsPrinterConnection "\\anotherPrintServer\Brother-1234"

      'If print server unavailable
      On Error Resume Next

      etc. etc.

      Thanks for your help / suggestions.

      All the best.

      Cheers,
      TC

      Comment


      • #4
        Re: 2003 Domain Suppress Printer Errors

        I usually put it at the very start of my script.

        Code:
        Option Explicit
        
        On Error Resume Next
        
        Dim WSHNetwork
        
        Set WSHNetwork = CreateObject("WScript.Network")
        
        WSHNetwork.RemovePrinterConnection "Printer Name"
        WSHNetwork.RemovePrinterConnection "Printer Name"
        WSHNetwork.RemovePrinterConnection "Printer Name"
        
        WSHNetwork.AddWindowsPrinterConnection "Printer Name"
        WSHNetwork.AddWindowsPrinterConnection "Printer Name"
        WSHNetwork.AddWindowsPrinterConnection "Printer Name"
        
        WSHNetwork.SetDefaultPrinter "Printer Name"
        
        WScript.Quit(1)
        This is my remove printers then add printers script. Crude i know but it works.

        Comment

        Working...
        X