Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting default printer

Status
Not open for further replies.

zahead31

MIS
Jun 5, 2006
174
US
I am using a vbs script to set the default printer. I am using the following code:

set wshnetwork = createobject("wscript.network")
wshnetwork.setdefaultprinter "\\server\printername"


This works for every printer except one. I am unsure why I am unable to set this one specific printer as the default printer on any CPU on my network. Please help!
 
Could you show all of your code? What specifically does not work? Is there an error message? If so, what is the error? Do you use On Error Resume Next in your script? If so, do you get an error when you comment it out? If you do, what is the error?

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Thanks for the quick reply.

Those 2 lines are all the code. The error message that pops up states "There is no printer called 'Lexmark C510'"

I do not have an On Error Resume Next statement in the script.

My apologies for my ignorance - I am not a programmer by any means. I just have enough working knowledge of some computer languages to figure simple scripts on my own.

Thanks again
 
And you are absolutely certain that you are giving the correct server and printer name?

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
And obviously this printer is defined in the local PC ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top