Mapping Net work Drive with available drive letter in login script

Hi,
I am trying to develop a script to parse the login.bat file to see what drives are already mapped and to use available drive letters. Since I am not that much familiar with string manipulation, Kindly help.

Although you can parse the file, if you are mapping a drive on the end point it’s probably easier to actually let the batch file complete and then see what drive letter is available. You can look at using WMI to enumerate what is currently mapped with:

Win32_MappedLogicalDisk

Parsing is an option, but if you would like to do that it would beneficial to provide an example of how the .BAT looks.

Paul, while PowerShell can and will do this for you, if you have more than a handful of computers you are trying to manage, it is a poor, deprecated method. You really should (from a TCO and overall management standpoint) be using group policy preferences to manage drive mappings. It may, because of poor and inconsistent mapping in the past, cause some additional work up front to standardize, but it will be worth in in the long run.

In the meantime if you really want to script this (again, not my first recommendation), do a Google/Bing search on “PowerShell next available drive”. There are a lot of solutions already out there.

Thanks Rob & Bob, for your valuable inputs. Will keep you posted on the development.