Code  80020009 – There is no printer called:

Troubleshooting Error Code 80020009 – There is no printer called:

Introduction to Code Error 80020009 VBScript

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"

Solarwinds Free WMI MonitorGuy Recommends: WMI Monitor and It’s Free!

Windows Management Instrumentation (WMI) is one of the hidden treasures of Microsoft operating systems.  Fortunately, SolarWinds have created the WMI Monitor so that you can examine these gems of performance information for free.  Take the guess work out of which WMI counters to use for applications like Microsoft Active Directory, SQL or Exchange Server.

Download your free copy of WMI Monitor


Do you need additional help?

Give something back?

Would you like to help others?  If you have a good example of this error, then please email me, I will publish it with a credit to you:

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

If you like this page then please share it with your friends