Advertisement

09.12.2008 at 08:02AM PDT, ID: 23726629 | Points: 500
[x]
Attachment Details

Using vbscript to connect users to print server and adding several printers

Asked by Sirdots in Scripting Languages, Visual Basic Programming, VB Script

Tags: ,

I have a print server called \\bassey

if i go to start,run and type \\bassey,
I get a login and password screen which I have to enter
my credentials before I can have access to the printer list.

I am using vbscript which will automally add printers when
i login.

How can i write this using vbscript to capture the username
and password so that users will have access to \\bassey.


Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
Here is my code
------------------
 
Option Explicit
Dim objNetwork 
Dim strDriveLetter, strRemotePath1,strRemotePath2, strUserName
strDriveLetter = "P:" 
strRemotePath1 = "\\Johnson2."
strRemotePath2 = "\\Jappy4" 
 
'1. create a form that prompts users for their username(firstname.lastname)
	dim username,password
	username=InputBox("Enter your username in this format [Firstname.Lastname]")
	MsgBox("Your name is " & username)
 
	password=InputBox("Enter your password:")
	
	
'2  Use credentials entered to login to \\bassey
'   how can i do this using vbscript????
 
 
'3  Connect printers for users to have access.
 
	Set objNetwork = CreateObject("WScript.Network") 
	objNetwork.AddWindowsPrinterConnection "\\bassey\zombie-70"
[+][-]09.12.2008 at 09:33PM PDT, ID: 22465624

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628