Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


VB Script to find default printer

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,24097
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> VB Script to find default printer
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 VB Script to find default printer - 7/26/2005 5:44:04 AM   
  allowishes

 

Posts: 9
Score: 0
Joined: 7/26/2005
Status: offline
Hello-

I need to write a script that when ran will:

1) Remove certain printers from user's printer folder

2) Install other printers

3) Check to see if they have a default printer set up and if they don't...

4) Make one of the printers that was installed the default.

I have step 1, 2 and 4.

My problem is trying to get the scrpit to find the default printer if there is one.

I know that that info is stored in the HKEY_CURRENT_USER\Software\Microsoft\Windows
NT\CurrentVersion\Windows\Device key.

I just can't seem to extract it so I can put it in an if...then...else statement.

Some background...

We have a bout 40 to 50 users moving to another floor. They will need to be set up with new networked printers. So we need to remove their "old" printers and install "new" ones. However some of the users have local printers as well set as their default. We don't want to mess this up. So all users will get network printers but only some of them will have one of those network printers set to their default printer.

_____________________________

Thanks!
Justin
 
 
Post #: 1
 
 RE: VB Script to find default printer - 7/26/2005 5:50:14 AM   
  tnoonan

 

Posts: 364
Score: 0
Joined: 12/14/2004
From:
Status: offline
http://www.spoogenet.com/index.php?module=article&view=7&5cbaa9d36385e275f0a415eb9b827618=039404aa5c8318ba3d41b8e7d3ad6db7

_____________________________

If you can conceive it you can achieve it
___________________________________

www.spoogenet.com

(in reply to allowishes)
 
 
Post #: 2
 
 RE: VB Script to find default printer - 7/26/2005 6:28:20 AM   
  allowishes

 

Posts: 9
Score: 0
Joined: 7/26/2005
Status: offline
Thanks for the reply...but Im a little lost.

This scrpit sets it to a variable...but what if the computer has no default printer?

_____________________________

Thanks!
Justin

(in reply to tnoonan)
 
 
Post #: 3
 
 RE: VB Script to find default printer - 7/26/2005 6:45:35 AM   
  tnoonan

 

Posts: 364
Score: 0
Joined: 12/14/2004
From:
Status: offline
If get_current = "" then
WScript.Echo "no printer"
else
wscript.echo get_current
end if

_____________________________

If you can conceive it you can achieve it
___________________________________

www.spoogenet.com

(in reply to allowishes)
 
 
Post #: 4
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> VB Script to find default printer Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts