Techwarelabs Community

Techwarelabs Community (https://www.techwarelabs.com/community/index.php)
-   Operating Systems (https://www.techwarelabs.com/community/forumdisplay.php?f=17)
-   -   Mapping network drives through commands (https://www.techwarelabs.com/community/showthread.php?t=10171)

vee_ess 10-05-2004 03:33 AM

Mapping network drives through commands
 
Ignore the subject; it's just the net use command. I have a VPN connection and several network drives to map each time the VPN is connected. I can have the network drives reconnect at logon, but that would require me to have enable the VPN to require logging on before the Windows logon can be accessed.

I do not want the VPN logon to come on at the Windows logon screen, except for a particular user, so I was hoping someone would be able to help me write custom logon scripts so that the VPN logon screen comes up when a particular user logs in, before their settings are loaded.

Since that's unlikely, I was hoping for another option which would allow the VPN logon come up through the startup folder (or registry equivalent) and then I can click on a shortcut (or script) to map all the drives. The only thing I can think of, (which works pretty well actually,) is a batch file with a series of net use commands. The problem I'm facing is that I don't want the drives to reconnect at logon and I don't know how to use the /persistent: no in a batch, because that needs to go on a new line.

james 10-05-2004 07:09 AM

ok, i'm a bit unclear on what you want.

1) You want automagic mapping of drives when connecting to a VPN connection?

2) You want one user to logon to the VPN when logging into Windows?
2a) You want that user to get automagic mapping of drives when connecting to the VPN as well.

A couple years ago I tried quite hard to get a startup script to run when connecting to a VPN with no luck.

On another note, I do not believe that /persistent: no needs a new line. I've used it all in one line in batch files without issue, and I believe it was working properly. At least, the users who said they were having issues with that stopped bitching about the hang up issues associated with windows' attempt to have persistent mapped drives connected. This shoudl work

Code:

net use X: \\server\share /PERSISTENT:NO

james 10-05-2004 07:11 AM

on another note, i have a script that maps drives on my laptop for my home network. Is there anyway I can get it to give me a prompt asking if I want it to continue or cancel the operation at the beginning of the script, and that would timeout after 30 seconds with an auto-yes. (even a prompt would be fine, but a <x> second timeout would be uber-cool)

vee_ess 10-05-2004 02:51 PM

Thanks, James. I don't know why I had it stuck in my head that I had to have /PERSISTENT:no on a new line. It's working find for me now.

I'm not sure how you could get a timeout, but I know of a way to add a prompt. Use the Install Express program (IExpress.exe in the system32 folder). It's pretty self-explanatory so just go through it, the only options you really need to change are to add a confirmation prompt and run the batch file as the installation program.
(Create new SED > Extract and Run command > Prompt's Title > Make sure you use a prompt!!!! > don't use a license > add batch file > the rest is up to you...)

Jason425 10-05-2004 03:10 PM

omg I never heard of iexpress before, that's awesome!

vee_ess 10-05-2004 03:37 PM

IExpress is definately good stuff, it can help to automate so many things, especially when combined with batch files and commands.

I did forget about another useful tool, however, so you can prompt inside the batch file itself: the set and if commands. Here's an example of what you batch file would look like:
Code:

set /p answer=Would you like to map the drives [Y/N]?
if '%answer%'=='N' goto EOF
if '%answer%'=='n' goto EOF
net use i: \\server\share /persistent:no
net use j: \\server\share2 /persistent:no
:EOF

IExpress looks a lot more professional, however.


All times are GMT -5. The time now is 11:31 AM.

Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.