troubleshooting Question

script that asks user for credentials and maps drive

Avatar of UBB
UBB asked on
VB Script
13 Comments1 Solution3718 ViewsLast Modified:

I need to build a script that will prompt a login credentials that are different to their windows credentials.  
if the login is correct, it maps the I drive to a Unix Server

there is a net use command file used at the moment that maps the drive to a generic user account but I need it to map to specific user accounts?

so far, using different scripts online, I have managed to come up with the following.

Option Explicit
Dim objNetwork, objShell
Dim strDriveLetter, strRemotePath, strUserName, strPas
strDriveLetter = "I:"
strRemotePath = "\\Blah\%HOME%\"

' Purpose of the script to create a network object. (objNetwork)
' Then to apply the MapNetworkDrive method. Result I: drive
Set objNetwork = WScript.CreateObject("WScript.Network")
' Here is where we extract the UserName
strUserName = InputBox("CIMS username ")
strPas = InputBox("CIMS password ")
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath & strUserName & StrPas

' Bonus code to open Explorer at the mapped drive letter
Call ShowExplorer

Sub ShowExplorer()
Set objShell = CreateObject("WScript.Shell")

I do not really have any VBS knowledge - its more trial an error on my part for the moment

when I run the above script, I am asked for username and password which is good but I then get an error.

Script: test.vbs
Line: 18
char: 1
Error: the specified network password is not correct

Code: 80070056
Source: WSHNetwork.MapNetworkDrive

any help would be great


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 13 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 13 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros