?
Solved

Mapped Network drives

Posted on 2003-03-10
26
Medium Priority
?
1,120 Views
Last Modified: 2010-04-13
Hi

I have a problem with mapped network drives in Windows 2000. When I check the box "reconnect at next logon", windows refuses to remember the password that was used to connect to the mapped drive. I know that with the use of "net use" I can create a logonscript, but DOS scripts are not an option.
How can I make WIndows remember the network drive passwords?

Thanks

Wandalf
0
Comment
Question by:Wandalf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 6
  • 6
  • +3
26 Comments
 
LVL 6

Expert Comment

by:danich
ID: 8102928
The Remember Password checkbox depends on the user having a logon (local or domain) in the first place. The passwords are then stored in a .PWL file which is unlocked by the logon. If you are not logging into the machine at startup there is no secure place to store the password(s), thus they are not remembered.
0
 
LVL 2

Expert Comment

by:antonsigur
ID: 8102962
I'm not sure you can.
You could go the other way, set the network drive security, in a way, that the remote computer can map the drive.

This is a nice cmd script, connects and disconnects the drive v:

@echo off
if not exist v: goto install
goto uninstall
:install
net use v: \\server\share$ /user:server\username password
goto end
:uninstall
net use v: /delete
:end

You could include a key in registry, this would run for all users, you could setup a CURRENT_USER key there too

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"drive1"="net use v: \\server\share$ /user:server\username password"

But again, I use net use, and you don't wan't to use that tool....
0
 

Author Comment

by:Wandalf
ID: 8103067
Net use is indeed not an option, because I have a Windows Terminal Services environment here, and whenever DOS is accessed (through a script or DOS program) exception errors are created in a in-house written piece of software.
So any script that runs in DOS is out of the question. Maybe I can use VBScript or JScript to make the connection?
0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 2

Accepted Solution

by:
antonsigur earned 100 total points
ID: 8103205
yes okey., this is a vbs code You just replace it with your username and passsowrd, sharename and on you go.

You just run it!

Set objNetwork = Wscript.CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "y:", "\\server\share", false, "server\user", "password"
0
 
LVL 2

Expert Comment

by:antonsigur
ID: 8103230
Yes, and if you call the script "map.vbs" you can doubleclick it, or run it with "cscript map.vbs"
or "wscript map.vbs" You could put in in a registry like this:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"drive1"="wscript C:\map.vbs"
0
 
LVL 85

Expert Comment

by:oBdA
ID: 8104213
Hi Wandalf,

maybe you just used the wrong terminology, but the standard NT shell (cmd.exe) is NOT a DOS Box (command.com), though both can be started in NT and look similar.
cmd.exe is a regular 32bit program, it's needed for basic functionality, and it shouldn't interfere with other software. If it's nevertheless really cmd.exe that's interfering with your in-house software, there's something seriously wrong with your software.
If you start a batch file and it runs in the 16bit environment (NTVDM), you might want to check your ComSpec variable; that should point to %SystemRoot%\system32\cmd.exe.
0
 
LVL 2

Expert Comment

by:antonsigur
ID: 8104281
Yes, Wandalf, cmd is a not a dos... "net" function is not a dos function.. ..
But did my comments help you? Do you need more help?
0
 
LVL 1

Expert Comment

by:Premiernc
ID: 8107251
This sounds horrible, but if you do not use scripts to map the drives or control the access to them, and you are using terminal services, it will always ask you for the password to create connections. Try implementing the guest account certain shares, be careful. If you do it right you shouldn't have to many issues with security.
0
 

Author Comment

by:Wandalf
ID: 8109143
Hi

to oBdA : you're right, I did use the wrong terminology, but it is in fact the standard NT shell (cmd.exe).
My ComSpec variable points to %SystemRoot%\system32\cmd.exe, but still when I start a batch file (.bat), and I monitor the task manager, both the cmd.exe and ntvdm.exe process are activated.
About the in-house software, I know something is wrong with it, but I didn't implement it, my job is to provide the systems, so I'm stuck  with it.

to antonsigur : I'm still working on the scripts you proposed, but they might be the answer. The only problem is, when I run the script, all the mapped drives are opened in Explorer each time the script runs.

to Premiernc : I will try to allow the guest account on certain shares.
0
 

Expert Comment

by:yoann_prout
ID: 8109340
You can try these 2 little VBScript, copy/paste code in 2 .vbs files :

'Login
Option Explicit

Dim WSHNetwork
Set WSHNetwork = WScript.CreateObject("WScript.Network")

'Map drives
'object.MapNetworkDrive strLocalName, strRemoteName, [bUpdateProfile], [strUser], [strPassword]
'[bUpdateProfile] : Use TRUE instead of FALSE if you want a persistent mapping, info will be store in your profile

WSHNetwork.MapNetworkDrive "F:", "\\Server\system_volume", False, StrUserName, StrPassword
WSHNetwork.MapNetworkDrive "G:", "\\Server\volume_1", False
WSHNetwork.MapNetworkDrive "H:", "\\Server\volume_2", False
WSHNetwork.MapNetworkDrive "X:", "\\Server\volume_2\users\My_Name", False

_________________________________________________________________________________________________

'Logout
Option Explicit

Dim WSHNetwork
Set WSHNetwork = WScript.CreateObject("WScript.Network")

'"Unmap" drives
'object.RemoveNetworkDrive strName, [bForce], [bUpdateProfile]
'[bForce] : Remove mapping even if distant ressources are in use
'[bUpdateProfile] : Use TRUE if you want the mapping to be removed from your profile


WSHNetwork.RemoveNetworkDrive "F:", True, True
WSHNetwork.RemoveNetworkDrive "G:", True, True
WSHNetwork.RemoveNetworkDrive "H:", True, True
WSHNetwork.RemoveNetworkDrive "X:", True, True

WScript.DisconnectObject WSHNetwork
0
 

Expert Comment

by:yoann_prout
ID: 8109352
You can try these 2 little VBScript, copy/paste code in 2 .vbs files :

'Login
Option Explicit

Dim WSHNetwork
Set WSHNetwork = WScript.CreateObject("WScript.Network")

'Map drives
'object.MapNetworkDrive strLocalName, strRemoteName, [bUpdateProfile], [strUser], [strPassword]
'[bUpdateProfile] : Use TRUE instead of FALSE if you want a persistent mapping, info will be store in your profile

WSHNetwork.MapNetworkDrive "F:", "\\Server\system_volume", False, StrUserName, StrPassword
WSHNetwork.MapNetworkDrive "G:", "\\Server\volume_1", False
WSHNetwork.MapNetworkDrive "H:", "\\Server\volume_2", False
WSHNetwork.MapNetworkDrive "X:", "\\Server\volume_2\users\My_Name", False

_________________________________________________________________________________________________

'Logout
Option Explicit

Dim WSHNetwork
Set WSHNetwork = WScript.CreateObject("WScript.Network")

'"Unmap" drives
'object.RemoveNetworkDrive strName, [bForce], [bUpdateProfile]
'[bForce] : Remove mapping even if distant ressources are in use
'[bUpdateProfile] : Use TRUE if you want the mapping to be removed from your profile


WSHNetwork.RemoveNetworkDrive "F:", True, True
WSHNetwork.RemoveNetworkDrive "G:", True, True
WSHNetwork.RemoveNetworkDrive "H:", True, True
WSHNetwork.RemoveNetworkDrive "X:", True, True

WScript.DisconnectObject WSHNetwork
0
 
LVL 2

Expert Comment

by:antonsigur
ID: 8110271
yoann_prout: I gave him this Wscript earlier....

Set objNetwork = Wscript.CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "y:", "\\server\share", false, "server\user", "password"

Wandalf: When I run this vbs script, it doesn't open a explorer window, it just maps the drive.... Does it open a window? Ore does the "net use" open window?
0
 

Author Comment

by:Wandalf
ID: 8110412
antonsigur, each time I activate the script, all mapped drives are opened in seperate explorer windows. I Don't know what causes that behaviour.
"Net use" doesn't open explorerwindows
0
 
LVL 2

Expert Comment

by:antonsigur
ID: 8110443
How do you activate the script?
0
 

Expert Comment

by:yoann_prout
ID: 8110489
Yes antonsigur, excuse me.
(I saw it after sending my comment... I have started writing it this morning but was called outside my desk, then I have submitted it after you, but at this moment, I was not able to see yours... blabla)

Anyway... I explain things you don't, then just take my comment as a complement.

Wandalf : Do you finally use "net use" via cmd line or MapNetworkDrive with VBScript ?
0
 

Expert Comment

by:yoann_prout
ID: 8110491
Yes antonsigur, excuse me.
(I saw it after sending my comment... I have started writing it this morning but was called outside my desk, then I have submitted it after you, but at this moment, I was not able to see yours... blabla)

Anyway... I explain things you don't, then just take my comment as a complement.

Wandalf : Do you finally use "net use" via cmd line or MapNetworkDrive with VBScript ?
0
 

Expert Comment

by:yoann_prout
ID: 8110502
Yes antonsigur, excuse me.
(I saw it after sending my comment... I have started writing it this morning but was called outside my desk, then I have submitted it after you, but at this moment, I was not able to see yours... blabla)

Anyway... I explain things you don't, then just take my comment as a complement.

Wandalf : Do you finally use "net use" via cmd line or MapNetworkDrive with VBScript ?
0
 
LVL 2

Expert Comment

by:antonsigur
ID: 8110542
Yes yes... no harm done...
0
 

Expert Comment

by:yoann_prout
ID: 8110600
Oooooooooooola

I PROMISE I only click ONE time on "submit"... There's some Internet connection problem today here and I think it's the reason why my comments are duplicated...

Sorry.
0
 

Author Comment

by:Wandalf
ID: 8110649
yoann_prout : I don't want to use "net use"
The whole idea of this question here is to eliminate the use of "net use", because for some unknown yet bizarre reason it causes exception errors in a piece of software we use.
No harm done with the multiple replies

antonsigur : I've activated the script in 3 different ways : first just by doubleclicking, second by placing it in the startup folder of a specific user an third by going to start->run "wscript c:\mapdrive.vbs".
But the explorerwindows just keep on popping up.
0
 
LVL 2

Expert Comment

by:antonsigur
ID: 8110679
strange as hell...
I'm looking for solution... hmmm
0
 
LVL 2

Expert Comment

by:antonsigur
ID: 8110741
I've tried this on five computers...

One XP
One W2kpro
Two w2k servers

Once on the console
And once on a diffrent server, runnig as terminal application server...

No popping up windows..

-------
Finding solution:
Are there any network drives, connected or "disconnected" in "my computer" ? If there are, disconnect them.

Try using "cscript c:\mapdrive.vbs" - does it pop up?

What version of wscript are you using, I'm running 5.6.0.6626

Try run in batch mode, "wscript //B C:\mapdrive.vbs"

Finally, did you try running it from the registry?

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"drive1"="%SystemRoot%\system32\wscript c:\mapdrive.vbs"
0
 
LVL 85

Expert Comment

by:oBdA
ID: 8111290
Hi Wandalf,

seems like there's something not right with your server, independent of your in-house software. Starting a .bat that only contains internal shell commands or 32bit program calls should not open the NTVDM. Avoiding a script file because of that is treating the symptoms, not the cause of the problem.
You could try several things:

* Open Windows Explorer and navigate to %systemroot%\system32; check out the properties of cmd.exe and command.com. cmd.exe should have only the regular four tabs and display an icon; only command.com should have the additional 16bit tabs and have the default "empty window" icon.

* start cmd.exe from the run menu (that should not open the NTVDM) and type 'assoc | find /i ".bat"'; it should respond with '.bat=batfile'; now type 'ftype batfile', that should respond with 'batfile="%1" %*';trying the same with '.cmd' should return 'cmdfile' and 'cmdfile="%1" %*.

* Start regedit and go to HKCR; check out if '.bat' and '.cmd' have the same entry in "PersistentHandler"

* Create a batch file with a "net use" statement (or just a 'pause' command), save it as <SomeFileName>.CMD (not .bat), and start that. The NTVDM process should not start.

* Try if the links in http://www.microsoft.com/technet/treeview/default.asp?url=/technet/prodtechnol/windows2000serv/support/FAQW2KCP.asp can be of any help.
0
 

Author Comment

by:Wandalf
ID: 8111917
antonsigur: the problem of the explorer windows is solved.
I was using the original wscript engine that came with windows (5.1). After I installed the 5.6 release, no pup-ups.
Now 1 single question remains : is the method of running it from the registry considered the "cleanest way" : least chances of tampering?

oBdA : I'll try your suggestions tomorrow, running low on time now.
0
 
LVL 2

Expert Comment

by:antonsigur
ID: 8112077
No, this is just a alternate...

If you put it in the startup folder, then everyone sees it... It is somewhat "hidden" if you put it in the registry (hidden from the users)

You just do what you like best, I would probably putit in the registry if it where the same for all users, (under LOCAL_MACHINE) but if the mappings differs from user to user, or if it is only for one user, then I would just put it in the startup folder.
0
 

Author Comment

by:Wandalf
ID: 8478058
Sorry to all for the delay

It seems that the error generated in the software doesn't originate from the use of "net use". It is the result of memory problems, about which I will post a different question, as the errors still remain.

The points will be rewarded to antonsigur, as he was the first to provide the script which didn't really solve this problem, but it was usefull for other environments.
Thank you for that antonsigur.

Sincerely
Wandalf
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
Active Directory can easily get cluttered with unused service, user and computer accounts. In this article, I will show you the way I like to implement ADCleanup..
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question