Mapping Net work Drive with available drive letter in login script

This topic contains 3 replies, has 3 voices, and was last updated by Profile photo of Paul Francis Maheswaran Paul Francis Maheswaran 7 months, 2 weeks ago.

  • Author
    Posts
  • #38332

    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.

  • #38337
    Profile photo of Rob Simmers
    Rob Simmers
    Participant

    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.

  • #38338
    Profile photo of Bob McCoy
    Bob McCoy
    Participant

    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.

  • #38370

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

You must be logged in to reply to this topic.