Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Using VB Script to install network printer on win9x clients

Posted on 2005-03-02
Medium Priority
Last Modified: 2013-12-29
I have this script that I located on web that will install a network printer on a Win2K or XP machine and make it the default printer.

Script contents:

Set WshNetwork = CreateObject("WScript.Network")
PrinterPath = "\\server_name\printer_share_name"
PrinterDriver = "Full_Printer_Name"
WshNetwork.AddWindowsPrinterConnection PrinterPath, PrinterDriver
WshNetwork.SetDefaultPrinter "server_name\printer_share_name"

End of script

However, the script will not run correctly on Win9x clients. Can anyone explain why and offer a resolution?

Thank you.
Question by:mperez1216
  • 3
  • 2

Accepted Solution

Anthony_E earned 200 total points
ID: 13445845
Well Microsoft's site says this script works, maybe just use these 3 lines which u already have in your script..
Script from here:  http://www.microsoft.com/technet/scriptcenter/scripts/printing/client/prclvb01.mspx

Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection "\\PrintServer1\Xerox300"
WshNetwork.SetDefaultPrinter "\\PrintServer1\Xerox300"

Author Comment

ID: 13489680
Will the script on a legacy Win 95 system also?

Author Comment

ID: 13717403
Thank you Anthony_E. Just using the the 3 lines resolved the issue. I also believe that I do not use the SetDefaultPrinter statement, this will only install the printer and leave the currently installed default printer alone.

For example, the user has a local Epson printer as default. I run the script to install the network printer. Now the user has the local Epson still as the default, but now also has the Xerox300 available.

Is this correct?

Expert Comment

ID: 13721589
yeah thats correct, i had trouble using that SetDefaultPrinter statement on my win9x machine also, but the 2000 and XP machines it worked maybe something with windows 98...

Author Comment

ID: 13725983
thank you again.

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is a real story and is one of my scariest tech experiences. Most users think that IT experts like us know how to fix all computer problems. However, if there is a time constraint and you MUST not fail the task or you will lose your job, a simple …
In this tutorial, we’re going to learn how to convert Youtube to mp3 for Free. We'll show you how easy it is to make an mp3 from your video clips so that you can enjoy them offline.
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question