Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VPN login Script

Status
Not open for further replies.

breader

IS-IT--Management
Nov 27, 2002
120
CA
I want to run a script, to map drives mostly, for my VPN clients. I used CMAK to create the distribution file for the clients and it works fine but if I try to inclued a command like SERVER\NETLOGON\login.bat I get a message that UNC paths are not supported.
How and were can I run Login Scripts.
I don't really want to use Rasdial.
 
Even if you could include such a line, it would not be a really good idea. Connection Manager offers no error handling in such a situation.

In very early versions, you could manually add a line in the connect actions in the cms file, but the unc was often not valid when the command fired depending upon the underlying connection.

Better way (and the supported way) to handle this would be to write another program to execute the command on the unc path. The 'program' could be a batch file, a script, or a compiled executable. Either way, you should include code to check the unc to make sure it is valid and wait and/or loop until it is valid. Be sure to provide an out in case it never becomes available. Place a copy of the file in the build folder for the connection and specify it in the post connection options.
 
I guess I can create a bat that uses net use to map the UNC and then disconnects it when im finished.
Thanks
 
I would love to know where to place this batch file to execute my login script for remote vpn clients?

I have a specific Mapping that I need for one VPN Client. But only when they are connected to the VPN.

Viper_iii_bwc@hotmail.com
 
this is what ive done so far.

using CMAK I've created a exe file that configures the connection for the client. one of the options is to specify a post-connection action. this is were i put the bat then i also put a bat in the disconnect section to remove the mapped drive.

only problem so far is that it takes about 2 minutes for the first bat to map all the drives, if you're using dialup
 
I'm using both ends High Speed...

I guess I'm Looking for CMAK!?! Where is this at?

I'm using right now the default vpn setup on windows 2000 and it will be on XP.

I'm not having any problems mapping as I can run the mapping manually Net use and it works instantly.

I'll need ya to maybe walk me through it I guess... CMAK!?
 
Okay Went through the CMAK

Now I'll have to install it I guess to test it....

It looks pretty good...

What is this about Error handling?

That is my fear I have my login scripts and logout scripst in place but what exactly should I use for Setup scripts Pre-Tunnel and Pre Connection?
 
right on high speed it maps quick but anyways....

CMAK is Connection Manager Administration Kit
It will be in Administrative Tools. If you don't have it you'll need the Admin pack installed.
You can find that on a 2000/2003 Server CD in the I386 directory
 
dont worry about the Pre stuff
it probably doesn't apply to you
 
Just wondering on the Pre stuff as a normal VPN does several setup negotiations in the scripts it runs before the connection doesn't it?

Ahh well I'll give the new profile a shot...
 
The 'pre' commands execute before the connection is even started. Can't think of many times you would use it . . . pehaps if you wanted to kill other connections before you start this one, clean a temp directory you wanted to use, start some kind of logging software . . . guess it might have a use.

Thankfully, the connection manager takes care of the negotiations. Not fun the old way.

The error handling that I was referring to . . . if you were to set connection manager to run a script hosted on the server, there isn't a good way to deal with a situation where the script is not available. If you write batch file to include with the connectoid, you could make allowances for the remote portion not being available. Not a big deal, but that is why it is configured the way it is. Hope that makes some sense.

On another note, there is a new version of the CMAK included with service packs (starting with SP2). The files are different, but I'm not sure what has changed. At any rate, I would use the one from the SP.
 
I was just wondering if someone could post their version of batch files that would do that. I just created two batch files with the following lines:
batchfile1: net use v: \\serverip\sharename
batchfile2: net use v: /delete

That works, but the problem is I get a message in a command propmt window when disconnecting that says: "There are open files and/or incomplete directory searches pending on the connection to v: Is it OK to continue disconnecting and force them closed? (Y/N) [N]:"

I would rather just force them closed automatically without asking the user this question.
 
NET USE V: /DELETE /Y

Worked under NT4, was never documented (so far as I know), not sure if it was carried forward or not.
 
Thanks mhkwook. That does what I asked, although is there any way to stop "There are open files and/or incomplete directory searches pending on the connection to v:" from showing? Even though it doesn't require the user to type "Y" anymore, that sentence still shows up on the command prompt window, and it sometimes takes 20-40 seconds to finish. Therefore, some users might get confused by this message instead of just ignoring it.
 

@ECHO OFF
CLS
ECHO
ECHO
ECHO
ECHO Cleaning up network connections . . . be patient
NET USE V: /DELETE /Y 2>NUL

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top