Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Runas... 2

Status
Not open for further replies.

MrTBC

Technical User
Nov 19, 2003
610
US
Windows 2000 Pro

Is there any way to use "runas" to open a network share (or file on a network share) using a unc path?

Many Thanks.
 
syntax
RUNAS [/profile] [/env] [/netonly] /user: program

key
/profile Option to load the user's profile (registry)
/env Use current environment instead of user's.
/netonly Use if the credentials specified are for RAS only.
/user Username in form USER@DOMAIN or DOMAIN\USER
(USER@DOMAIN is not compatible with /netonly)
program The command to execute

Examples:
runas /profile /user:mymachine\administrator CMD
runas /profile /env /user:SCOT_DOMAIN\administrator NOTEPAD
runas /env /user:user@domain.microsoft.com "NOTEPAD \"my file.txt\""

NOTE: Enter user's password only when prompted.
 
Thanks Auger282. I've tried:

runas /user:domain\administrator "explorer.exe \\server\share"

and various combinations with no success.
 
You seemingly cannot do this for one major reason. The operating system won't let you open explorer.exe under multiple credentials (the only time it lets you is if you access an administrative share). Here's the trick I have been using for years to get around this problem. Use Internet Explorer instead of Windows Explorer. I just do a Runas on Internet Explorer then change it to Folder view and use it like Explorer. There ya go..nothing to it.
 
runas /user:domain\administrator "iexplore -e \\server\share"

 
Thanks everyone. bcastner - I tried your suggestion and it prompts for a password and then displays an 'attempting to connect to...' message - but the folder doesn't open.
 
The prompt for password is normal. The failure to open the share would be if the \\server\sharename stuff was incorrect.

Try not passing the sharename and using the address bar once it opens to find the share you want to explore.
 
No joy with either of these either I'm afraid:

runas /user:domain\admin "iexplore -e"
runas /user:domain\admin iexplore -e
 
Internet Explorer's location is not typically in the path statement so you will need to provide the complete path to it. i.e
runas /noprofile /user:domain\username "C:\Program Files\Internet Explo
rer\Iexplore.exe \\server\share\folder
 
MisterNiceGuy,

My testing resolves iexplore, but I think you may be right that a full pathing is advisable. I would still suggest adding the -e command line parameter.

What troubles me is that the message returned to the poster was "'attempting to connect to...'", which suggests that the iexplore was resolved, but the sharename was not.
 
Gentlemen - we have a winner. Thank you all very much for your help:

runas /noprofile /user:domain\admin "C:\Program Files\Internet Explorer\iexplore.exe -e \\server\share
 
This was an interesting thread, and I am throwing a star to the occasionally less than eponymous MrNiceGuy for:

. the comment that Explorer is not re-entrant with changed credentials;
. pathing concerns

This is good stuff.
It bothered me that avoiding concern #1 by using iexplore -e, it did not resolve for the poster.

Good stuff.
 
Yes, thanks bcastner. I second that - top tip MisterNiceGuy!
 
I felt silly making the request, but I thought it deserved.
 
No I agree - this has also helped me with writing some vba today as well. Two for the price of one!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top