Even back in my olden days of using a non-free operating system, I was automating my tasks. The non-persistent sessions at the computer science lab required that I script my tasks. This is what I came up with for mapping network drives.
You can set a csv file with the following contents:
driveletter,sharename,username,password,vollabel SERVER,192.168.1.2 w,vol1\ben,,,W_svol1_ben x,vol1,,,X_svol1 y,vol2,,,Y_svol2 z,vol5,,,Z_svol5 SERVER,hulk s,hulk_ben,,,S_hulk_ben t,smash,,,T_smash SERVER,dax u,dax_ben,,,U_dax_ben v,science,,,V_science
So it’s not a real csv file; it’s got headers delineated by “SERVER” and a server name. The script will operate on the following lines, until the next “SERVER” line. It will mount the drive letter, from the following CIFS share, using a username and password or prompting if blank, and a pretty name. It will only mount those entries, if the SERVER actually is reachable. So it fails safely if you are on a different network than the requested server at the time.
I eventually scrapped this script when I deployed an Active Directory domain and I used group policy to define a number of mounts to define.