Previous Posts


Windows XP SP3 (Beta) Released to testers

Set IE default home page from a script

Add a new email domain to Exchange 2003

Backup your files using Remote Desktop

Force Windows 2003 to look like XP

Disable the Windows 2003 Shutdown Tracker

New SysInternals Tool: Active Directory Explorer

Can't open this item. There is not enough memory -...

Terabyte hard drives become mainstream

New line of Dell laptops



Archives

May 2005

January 2006

April 2006

May 2006

June 2006

July 2006

September 2006

October 2006

November 2006

December 2006

January 2007

February 2007

March 2007

April 2007

May 2007

June 2007

July 2007

August 2007

September 2007

October 2007

November 2007

December 2007

January 2008

February 2008

March 2008

April 2008

May 2008

June 2008

July 2008

August 2008

September 2008

October 2008

November 2008



Subscribe to our Feed:






Set default printer from a script

If you like this article, then sign up for our email newsletter to get more like it every day in your inbox

I helped do some IT work at an Insurance company over the weekend. A friend of mine is an IT manager there. I will take any chance I can to poke around a real life corporate network (Instead of playing around with a farm of Virtual Machines)...so it was worth the extra work.

One of the problems they had was a dead printer. We needed to move a group of users to an alternate one and needed an easy way to set the default printer without knowing all the passwords to everyone's account.

After a quick search I came up with this VB Script:

Set WSHNetwork = CreateObject("WScript.Network")
WSHNetwork.SetDefaultPrinter "[PRINTER_NAME]"

We updated the script so [PRINTER_NAME] was the name of the printer we wanted as our default. To find the correct name, simply open the Printers and Faxes icon in the control panel.

Printers and Faxes


Use the exact words you see under the printer. So for example, if I wanted to set the Laserjet 4500 as my default, the script would look like this:

Set WSHNetwork = CreateObject("WScript.Network")
WSHNetwork.SetDefaultPrinter "HP Color LaserJet 4500"

Then I saved the script to a network shared and named it update.vbs (Share name was \\serverdc\printer)

In the users logon script I added this line:

cscript.exe \\serverdc\printer\update.vbs


Now when the users login they will have the new printer as their default.


Posted By: Steve Wiseman on Thursday, August 09, 2007

Check out our utilities for windows

 



Copyright © IntelliAdmin, LLC, 2008. All Rights Reserved