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
vinimallAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

activeitnetworksCommented:
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

0
activeitnetworksCommented:
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

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2003

From novice to tech pro — start learning today.