|Klint, sorry I don't understand the code you suggest. Yes, the drive would still be mapped. I'd want to find out the map location and reassign it before disconnecting.|
My code would look something like this, with the bits I haven't figured out in brackets:
rem check if correct P: drive already mapped
IF EXIST P:\Templates GOTO ALREADY
rem check if P:drive mapped to something else
IF NOT EXIST P:\NUL GOTO MAP
rem Find out path of user's current P: drive
rem Map location of user's current P: drive to next available
rem Disconnect old P: drive
net use P: /d /yes
net use P: %SHARE_PATH% /persistent:yes
echo Share drive successfully mapped.
echo Share drive was already mapped.