set a default printer using GPO server 2003

Hi could anyone tell me how to set a default printer using GPO. I know I need logon script but Im ne to the script world. The printer is attached to my server, my server namer is "server" and my printer name is "HP01" thanks for any help
Who is Participating?
activeitnetworksConnect With a Mentor Commented:
I just grabbed a script from one of my servers, forgot to put some comments on it since you're new to scripting, here's the actual script with explanations:

'tell the vbscript engine to fail if you don't declare variables before use
Option Explicit
'IF you wish the script to keep running even if it's unable to connect the printer (also avoid displaying an error message), remove the ' from the following line {As opposed to what happens when you are connecting network drives, this script will not raise an error if you already have the printer connected on your machine even if you don't uncomment the next line}
'On Error Resume Next
'declare the objPrinter variable
Dim objPrinter
'now, create an object of type Network to get the printer items.
Set objPrinter = CreateObject("WScript.Network")
'Connect the printer to this computer
objPrinter.AddwindowsPrinterConnection "\\server\HP01"
'Set the printer as default
objPrinter.SetDefaultPrinter "\\server\HP01"

Open in new window

You can create a vbscript logon script using the following:

This will connect to a network shared printer and set it as the default printer.
Option Explicit
Dim objPrinter
Set objPrinter = CreateObject("WScript.Network") 
objPrinter.AddWindowsPrinterConnection "\\ServerName\PrinterName"
objPrinter.SetDefaultPrinter "\\ServerName\PrinterName"

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.