Computer Performance, Windows 2003, Exchange 2003, Logon Scripts

Code  80020009 - There is no printer called:

Troubleshooting Code 80020009 - There is no printer called:

Introduction to Code Error 80020009

This error code, 80020009 usually occurs when you execute a VBScript.  You are probably using a WScript method called SetDefaultPrinter.

The Symptoms you get Code 80020009 Error VBScript

The script does not set the default printer as you would have hoped.  Instead, you get an Windows Script Host error message, such as the diagram on the right. The probable scenario is that you are trying to create a Windows logon script.

The Cause of Code 80020009

The problem is that you need to map the printer FIRST, only then can you set it as the default.  Note that Source: WSHNetwork.SetDefaultPrinter gives a valuable clue.  Also check the line number of the error (Line: 4).

The Solutions

Include an extra method AddWindowsPrinterConnection  in your script. Look for clues particularly the Line: number and check the Char: references.  In the case of runtime errors, you can use this work around.  Add this line: On Error Resume Next.  However it is much better to try and cure the problem, then just use a work-around.

Example of a Code Error 80020009 Script

Part 1

Remember to add the SetDefaultPrinter command after you have first made the printer connection with this code: 

' VBScript.
Dim net
Set net = CreateObject("WScript.Network")
net.AddWindowsPrinterConnection "\\ServerName\PrinterName"

Below is a completed example, however remember that I do not know the name of your server or printer share, so substitute \\ ServerName for the name of a real server.

Part 2

' VBScript.
Dim net
Set net = CreateObject("WScript.Network")
net.AddWindowsPrinterConnection "\\ServerName\PrinterName"

Set net = CreateObject("WScript.Network")
net.SetDefaultPrinter "\\ServerName\PrinterName"

 


Computer Training Software - Recommended Training VideosGuy Thomas recommends Computer Training Software.  Their topics and material are ideal for getting you started with VBScript.  The videos are easy to follow and you can control the pace.  Try their free demo material and then see if you want to buy the full package. See more about VB Script Training CD.


Do you have a good example of this error?  If so, then email me I will publish it with a credit to you:

Do you need extra help?

For interpreting the WSH messages check Diagnose 800 errors.

For general advice try my 7 Troubleshooting techniques

What next? Try my eBook:

 


Download my Logon Script eBook for only $6.25

Logon ScriptThe extra features you get in your eBook include, more pages full of detailed examples.  Also, ten 'how to...' sections, with screen shots showing which menus to use.  Go for Guy's eBook - and get a printable version with copy enabled and no expiry date.

  Jumbo Script 7 Package

See also

 *


Google

WebComputerperformance.co.uk

GFi Events Manager

Guy Recommends: GFi EventsManager

Here is a solution to monitor, manage and archive thousands of events that are generated by devices across your entire network.  Get your free evaluation copy of GFI EventsManager.

 

Home Copyright © 1999-2008 Computer Performance LTD All rights reserved

Please report a broken link, or an error.