maping network printer via script

A

Alan Gavel

I have read several contributions on topic maping network printers by
scripts. The only one problem remained. How to add the username/password
into such a script?
My network department has several computers and we don't use central
server services. The printer is shared via "microsoft files and
printers sharing". The host computer has Windows XP but unfortunatelly
there are some Windows 2000 clients. They can't login to the host at
startup and everyday connecting with login/password is annoying. Each
station user has different login/password which differs from login
password for sharing network resources on host computer. I don't want to
make so many user account on host computer. Then, Is it easier to make
connection from client stations with net use syntax or might I use the
scripting host language? Could you be so kind and help me with
incorporating username/password into script or net syntax?

I have already found one script. If it is suitable for my situation
please add the username/password section.
--------------
Script start ->

On Error Resume next

Set WshNetwork = Createobject ("wscript.network")
Set WshShell = CreateObject("WScript.Shell")

PC = UCase(WshShell.ExpandEnvironmentStrings("%computername%"))

Select Case PC
Case "PRC1"
WshNetwork.addprinterconnection "lpt1", "\\printer1"
WScript.Echo "Mapped to printer printer1"
Case "PC2"
'Etc
End select

<- Script end
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top