Edu-IT Posted July 10, 2013 Posted July 10, 2013 I want to map a drive on a computer on another network, so it has a different domain, but it has dual network cards so there's an IP for it on our range. I need to specify the details to connect to this drive rather than use my normal login credentials. Is there a script that can be run at logon to do this? Any pointers? I assume something like net use S: \\server\folder but how do I give the login details?
tmcd35 Posted July 10, 2013 Posted July 10, 2013 net use S: \\server\folder /user:domain\username /password:password should do it, see net use /? for more details
bladedanny Posted July 10, 2013 Posted July 10, 2013 (edited) It should be net use s: \\server\share /user:domain\username password:password That should work. Edited July 10, 2013 by bladedanny
Edu-IT Posted July 10, 2013 Author Posted July 10, 2013 (edited) As we have command prompt disabled though how can I get it to play happy? Atm I suspect it'll come up with 'command prompt disabled'. Edit: Ah, if I run it as a logon script, it might be different. Edited July 10, 2013 by Edu-IT
bladedanny Posted July 10, 2013 Posted July 10, 2013 If it's set as a logon script through GPO it should still run. CMD is disabled for our students but the mapped drives here still run.
tmcd35 Posted July 10, 2013 Posted July 10, 2013 If it's for a single user (whose currently logged in) or a one off - you should be able to do it via the GUI. Windows should prompt for the username and password and their should be tick boxes to reapply at login and remember password. If it's a regular thing for all users then @bladedanny is right, put it in a logon.bat file.
mac_shinobi Posted July 10, 2013 Posted July 10, 2013 vbscript ? As per --> MapNetworkDrive | VBScript | SS64.com Dim objNetwork, strUser, strPassword Set objNetwork = WScript.CreateObject("WScript.Network") strLocalDrive = "S:" strRemoteShare = "\\myserver\Directory" strUser = "Domain\Username" strPassword = "MyPasswordHere" objNetwork.MapNetworkDrive strLocalDrive, strRemoteShare, False, strUser, strPassword False in the above command is to set if it is persistently mapped so if you need it to be persistent then just change this to True Although should do the same as the above mentioned bat file
Edu-IT Posted July 10, 2013 Author Posted July 10, 2013 I trued the BAT file option and placed it in scripts on Sysvol but it hung when the user tried to log in. Hmm? Tried just using this too in the hope it would pop up asking for auth but same thing. net use u: \\IP\share$
mac_shinobi Posted July 10, 2013 Posted July 10, 2013 The vb script any different or does that do the same ? Obviously open notepad, copy and paste code and adjust relevant bits ( domain\username, password, drive letter and the mapped path etc ), save as and in the filename text field when you are going to save it, type something along the lines of "MapDrive.vbs" Click Save and copy the script to the relevant sysvol area or wherever and assign as a logon script etc and try again
Edu-IT Posted July 10, 2013 Author Posted July 10, 2013 Spot on with the VBS :-) Thanks so much all. 1
Edu-IT Posted September 16, 2013 Author Posted September 16, 2013 Hmm. I want the drive to be available to multiple users but it seems to complain because the same credentials are being used by multiple people to map the drive. Any advice?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now