Thanks DK, however I believe that doing it this way using 'net use' does not add the printer in printers and faxes, and I would like to have this happen.
Main Topics
Browse All TopicsWe share office space with another tennant who needs to access our Network printers. They are on a workgroup, we are on a domain. I've installed another NIC in our print server (Win 2003Std) and assigned in an IP address within their segment. I can browse to the print server and need to enter domain usernam and password. After doing this I can connect each of the workstations to our printers and print OK. After rebooting the workstations I can no longer print and get the message "Print spooler not running" (even thought it is.). I need to then delete and re-add each printer.
One idea I had was to ass the printer each time usig the below vbs script, but how do I pass domain user credential in the script so user is not prompted?
('// Name: setprint.vbs
'// Description: Add a network printer and make it the default
Set WshNetwork = CreateObject("WScript.Netw
'// Adds the printer. Substitute your server name and printer share.
WshNetwork.AddwindowsPrint
'// Makes the specified printer the default.
WshNetwork.SetDefaultPrint
Many Thanks.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Use the AddPrinterConnection method instead.
quick refrence
object.AddPrinterConnectio
so change the line
WshNetwork.AddwindowsPrint
with
WshNetwork.AddPrinterConne
The below will add a SHARED printer on your Server or WORK station to whom ever runs it.
You can also set the printer as a defualt or not by removing the " ' " from the last line
Change the PrinterDrive Name and Printer Share name accordingly as well.
Set WshNetwork = CreateObject("WScript.Netw
PrinterPath = "\\SERVERNAME\iR5000"
PrinterDriver = "Canon iR5000-6000 PS3"
WshNetwork.AddWindowsPrint
'WshNetwork.SetDefaultPrin
There is no need to intiate username or password if you have your printer setup without restrictions on shared computer, or as long as your normal user has the proper rights given to him in the AD
Why would want to display in a script a username or password anyhow? The only reason you might need to use it that way is if you are not using Active Directory.
Well that problem can be fixed by encrypting the VBS file.
There are more than a few ways to skin that cat. But leaving a Username and Password in an exposed script is not smart at all. Not if you want a secure Network anyways.
Here's one such solution: http://www.experts-exchang
I would recommend however that you ad your workgroup into your AD however so that they are part of your Network's AD. If you need to restict them for some other reason from your network, Use Groups and GPO to do that , and or also use a seperate Subnet to help out as well.
Business Accounts
Answer for Membership
by: Dark_KingPosted on 2006-05-29 at 02:52:41ID: 16783186
Not what you ask for but you can use “net” to map a printer.
net use lpt2 \\ComputerName\ShareName password /USER:username
Or you can execute this net command from inside VB code.