CMAK mapping network drive scripts
Hi there, We have a VPN program, created by using CMAK program, for users to install pre-configured vpn program on their home computer. The program has 2 scripts that run with the vpn program: - logon.bat, runs after successfully connects - logoff.bat, runs when disconnecting for the logon script, it will map the user's home folder to H: >> net use h: \\server_path\user_folders\username /persistent:no while the logoff script will disconnect the H: when the user disconnect the vpn >> net use h: /delete /yes Problem is, some users have many devices (HDs, CD/DVD/BD drive, USB flash drive, etc) which eventually accumulate and eventually might be using the whole letters in the alphabet. What we need is 2 things: for the logon script to be able to map the home folder to the next available drive letter for the logoff script to be able to disconnect that drive from 1) when disconnecting I've been looking through several article but no luck finding out how to make logoff.bat knows which drive letter to be removed. Please let me know if this is not the right place to put this question.
December 22nd, 2009 4:44am

Use the '*' character instead of the drive letter to get the next available - the only thing is it works backwards from Z:. So "net use * \\server\share" will likely get you a z: drive, or a y: drive if Z: is already in use.The trick is knowing what drive you ended up with so that you can reference it later in the script, or know what letter to use from the command prompt. I'm sure there are scripts out there that demonstrate how to do that.Dave Bishop Senior Technical Writer Windows Server Networking User Assistance
Free Windows Admin Tool Kit Click here and download it now
December 22nd, 2009 5:54am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics