Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Mapping Network Drive

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Mapping Network Drive
  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 >>
 Mapping Network Drive - 5/16/2005 11:17:36 AM   
  adamgleiss

 

Posts: 7
Score: 0
Joined: 5/2/2005
From:
Status: offline
Hello and thanks to anyone in advance for any assistance. I am writing a script that maps four network drives. When you run the script it does this successfully but if you restart the computer you have to reenter the username and password for each network drive.

WShNetwork.MapNetworkDrive DriveLetterY, corp5Path, "True", username, password

I know the "True" paramter is supposed to persistantly map the drive each time a user logs on but how about a drive that requires a username and password? If you manually map a network drive you never have to reenter your username or password. Any help would be appreciated.
 
 
Post #: 1
 
 Re: Mapping Network Drive - 5/16/2005 11:30:18 AM   
  netmarcos

 

Posts: 55
Score: 0
Joined: 12/7/2004
From: USA
Status: offline
Whenever you map a persistent connection with alternate credentials, by default, you will be prompted for those credentials with each subsequent logon. There are ways to cache the credentials, but it is a better course of action to find a solution that would allow the connections to be mapped using the current user's credential.

(in reply to adamgleiss)
 
 
Post #: 2
 
 Re: Mapping Network Drive - 5/16/2005 11:46:24 AM   
  marcusrp

 

Posts: 145
Score: 0
Joined: 4/19/2005
From:
Status: offline
to elaborate on what netmarcos said, you are probably running the script under different login credentials than what are being used to login to the computer on restart. Windows will be wanting the username and password of the login that created the drives, which in this case is whatever you used in the script.

(in reply to adamgleiss)
 
 
Post #: 3
 
 Re: Mapping Network Drive - 5/17/2005 3:28:46 AM   
  adamgleiss

 

Posts: 7
Score: 0
Joined: 5/2/2005
From:
Status: offline
Thanks for the quick response. I can not use the current user credentials the way things are set up. That is true that the username and password are different for restart than for accessing the network drive, so how exactly do I cashe the credentials that I provide the in the script? Are there registry keys assigned for username and password of a mapped network drive?

(in reply to adamgleiss)
 
 
Post #: 4
 
 Re: Mapping Network Drive - 5/17/2005 4:14:48 AM   
  marcusrp

 

Posts: 145
Score: 0
Joined: 4/19/2005
From:
Status: offline
well, its hard to tell how youre using the script, but if you put the script in the startup folder of the 'all users' profile, it will run for every user that logs in. if running a vbscript out of the startup folder is unacceptable, you can run it remotely via a bat or cmd file, or if you are in a domain environment run it off the domain controller. there are a multitude of different options.

(in reply to adamgleiss)
 
 
Post #: 5
 
 Re: Mapping Network Drive - 5/17/2005 4:15:38 AM   
  netmarcos

 

Posts: 55
Score: 0
Joined: 12/7/2004
From: USA
Status: offline
In the case of Windows XP, cached credentials can be managed through the User Account applet in Control Panel | Advanced tab | Manage Passwords.

(in reply to adamgleiss)
 
 
Post #: 6
 
 Re: Mapping Network Drive - 5/17/2005 7:32:10 AM   
  adamgleiss

 

Posts: 7
Score: 0
Joined: 5/2/2005
From:
Status: offline
Here is my situation. I work in QA and we have a lab with machines dedicated for testing. Everytime we run a test the machine needs to have a "clean" os installed on it. I just want a script to map the drives we usually use. All the QA personel log on with the same generic login ID and password but need their own credentials to connect to the drives. My script( which is run off the desktop), prompts for username and password then connects to four drives, I just dont want to keep running the script each time the user (will be the same user each time) restarts the computer. The way netmarcos said about managing cached credentials in the User Accounts applet seems like the way to go if I could automate it once and not have to run the script again. Any ideas how to do that?

(in reply to adamgleiss)
 
 
Post #: 7
 
 Re: Mapping Network Drive - 5/17/2005 9:57:11 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
I don't believe "alternate credentials" are saved only per session and not permanently. If all they need is to access those shares, why not just give the generic userID read permission to the shares instead of messing around with alternate credentials ?

(in reply to adamgleiss)
 
 
Post #: 8
 
 Re: Mapping Network Drive - 5/18/2005 3:03:27 AM   
  adamgleiss

 

Posts: 7
Score: 0
Joined: 5/2/2005
From:
Status: offline
The user will need more than read permissions when using theses drives and I don't have authority to delegate permissions. If you map a network drive manually in this situation, it does stay connected on restart so there has to be a way to script a permanent connection. There must be a place in the registry but I can not find it.

(in reply to adamgleiss)
 
 
Post #: 9
 
 Re: Mapping Network Drive - 5/18/2005 3:46:32 AM   
  marcusrp

 

Posts: 145
Score: 0
Joined: 4/19/2005
From:
Status: offline
right, each time a system is rebooted and the user logs in, the HKEY_current_user section of the registry is rebuilt dynamically based on the profile settings of the user logged in, and this includes any drive mappings created under THAT USERS credentials. NOT yours. Again, the drive mapping was created using different credentials, and those are only included in HKEY_current_user when THAT user logs in. Like I said before, your best bet may be to include the proper user creds in your script like you originally did, and then put the script into the 'all users' startup folder. That way, when the system starts up, no matter who logs in the script will run, and hopefully the drives will map using the credentials hard coded into the script. If there are security problems with putting the creds directly on the machine, create a .bat or .cmd file in there instead that calls the script remotely.

(in reply to adamgleiss)
 
 
Post #: 10
 
 
 
  

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 >> Mapping Network Drive 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