|
Answer» Hi all, I'm sure this question has come up before, but I can't find anything using the search function, so I apologize for the repeat post in advance.
Anyways, onto my actual question:
I wrote a .bat file that opens up several network drives at once. Everything was going great until someone decided that one of these network drives could only be ACCESSED via admin IDS. Is it possible to set up a batch file to open a network drive using different logins/passes?
Thanks in advance!Assuming that you are running a command prompt under Windows, the answer is "yes".
If you have the following 2 shares: Z: as \\server1\share (username = "User" password = "password") Y: as \\server2\pub (username = "Admin" password = "admin"
You could do:
Code: [Select]net use Z: \\server1\share /user:User password net use Y: \\server2\pub /user:Admin adminSorry - yes I'm running in WinXP
How would you go about doing it if the drives were not mapped?
I'm not sure why, but if I have the drive already mapped when I log in to the computer (and, yes, it's set up to log in as a different user aka my admin id), when I double click the link I get an error saying the ID/Pass isn't valid. If I disconnect and remap the drive, I get an error saying I'm already logged in under a different name. I can only get it to work is when I FIRST map the drive after login.
You can't have the same share mapped as different USERS. For EXAMPLE, this would not work:
Code: [Select]net use Z: \\server\share /user:Administrator password net use Y: \\server\share /user:skreap newpasswordThis also would not work:
Code: [Select]net use Z: \\server\share /user:Administrator password net use Y: \\server\share\dir /user:skreap newpassword What do you mean "how would you go about doing it if the drives were not mapped"? Do you mean if the drives ARE already mapped? If they are NOT mapped, then it should work fine. If they ARE already mapped, then you may run into the scenario you mentioned, in which case you can disconnect the shares like:
Code: [Select]net use Z: /delete net use Z: \\server1\share /user:User password net use Y: /delete net use Y: \\server2\pub /user:Admin admin
|