I have a PC that is NOT on the domain (workgroup) that needs to connect at every login with a network drive on a domain server. every time the users reboot the machine, they forget to connect the mapped drive and it causes help desk calls in the middle of the night. If there was a way to have a script run at login that would mapp the drive and authenticate (that’s the kicker, I can figure out how to map the drive, but I can’t figure out how to get the script to also provide the username and password so they dont have to. Anyone have any ideas? Shawn<\/p>","upvoteCount":3,"answerCount":8,"datePublished":"2010-12-18T10:51:27.000Z","author":{"@type":"Person","name":"shawnwaldman3387","url":"https://community.spiceworks.com/u/shawnwaldman3387"},"acceptedAnswer":{"@type":"Answer","text":"
create the batch file called: drivemap.bat, and put it somewhere. put the shortcut to this file in the startup folder under the all users profile.<\/p>\n
the batch file should have this:<\/p>\n
net use H: \\server\\share /u:domain\\username password /persistent: no<\/p>\n
replace H: with the appropriate drive letter.<\/p>\n
that’s all there is to it.<\/p>","upvoteCount":0,"datePublished":"2010-12-18T11:38:38.000Z","url":"https://community.spiceworks.com/t/mapped-drive-script-help/72638/4","author":{"@type":"Person","name":"toddhayward","url":"https://community.spiceworks.com/u/toddhayward"}},"suggestedAnswer":[{"@type":"Answer","text":"
I have a PC that is NOT on the domain (workgroup) that needs to connect at every login with a network drive on a domain server. every time the users reboot the machine, they forget to connect the mapped drive and it causes help desk calls in the middle of the night. If there was a way to have a script run at login that would mapp the drive and authenticate (that’s the kicker, I can figure out how to map the drive, but I can’t figure out how to get the script to also provide the username and password so they dont have to. Anyone have any ideas? Shawn<\/p>","upvoteCount":3,"datePublished":"2010-12-18T10:51:27.000Z","url":"https://community.spiceworks.com/t/mapped-drive-script-help/72638/1","author":{"@type":"Person","name":"shawnwaldman3387","url":"https://community.spiceworks.com/u/shawnwaldman3387"}},{"@type":"Answer","text":"
put a shortcut to a batch file in the startup group that maps the drive (without any credentials) and they will be prompted to authenticate.<\/p>\n
Otherwise, you will have to hard code a username and password in the batch file, and that can be dangerous.<\/p>","upvoteCount":0,"datePublished":"2010-12-18T11:28:47.000Z","url":"https://community.spiceworks.com/t/mapped-drive-script-help/72638/2","author":{"@type":"Person","name":"toddhayward","url":"https://community.spiceworks.com/u/toddhayward"}},{"@type":"Answer","text":"
That is a good idea…but I would like to hard code the username and password. The credentials aren’t a secret so that’s not a big deal. Anyone have any sample scripts that I can model off of?<\/p>","upvoteCount":0,"datePublished":"2010-12-18T11:34:04.000Z","url":"https://community.spiceworks.com/t/mapped-drive-script-help/72638/3","author":{"@type":"Person","name":"shawnwaldman3387","url":"https://community.spiceworks.com/u/shawnwaldman3387"}},{"@type":"Answer","text":"
+1 for dns plus but do make sure theres nothing sensitive on that drive<\/p>","upvoteCount":0,"datePublished":"2010-12-18T11:43:07.000Z","url":"https://community.spiceworks.com/t/mapped-drive-script-help/72638/5","author":{"@type":"Person","name":"peter","url":"https://community.spiceworks.com/u/peter"}},{"@type":"Answer","text":"
Will do Peter, Thanks DNS plus, I appreciate eveyones help on this. It’s greatly appreciated.<\/p>","upvoteCount":0,"datePublished":"2010-12-18T11:46:44.000Z","url":"https://community.spiceworks.com/t/mapped-drive-script-help/72638/6","author":{"@type":"Person","name":"shawnwaldman3387","url":"https://community.spiceworks.com/u/shawnwaldman3387"}},{"@type":"Answer","text":"
Dont forget that on Windows Vista / Windows7, the batch file may have permission problems in certain folders. If I have to use one for a specific reason I put it in all users\\startup folder but as previously stated, be careful about storing passwords this way as when the batch is run it will flash the password up on the screen as it makes the connection.<\/p>","upvoteCount":0,"datePublished":"2010-12-18T23:10:13.000Z","url":"https://community.spiceworks.com/t/mapped-drive-script-help/72638/7","author":{"@type":"Person","name":"pcsm","url":"https://community.spiceworks.com/u/pcsm"}},{"@type":"Answer","text":"
It is often a good idea to delete any previous mappings eg.<\/p>\n
net use H: /delete<\/strong><\/p>\n (replace H: with the appropriate drive letter again)<\/p>\n Just stops errors if the drive letter is somehow being used by something else (such as a user mapping a drive)<\/p>","upvoteCount":0,"datePublished":"2010-12-19T20:58:46.000Z","url":"https://community.spiceworks.com/t/mapped-drive-script-help/72638/8","author":{"@type":"Person","name":"petermorris9539","url":"https://community.spiceworks.com/u/petermorris9539"}}]}}