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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Configure IE Explorer to Always Run As Another User

Status
Not open for further replies.

YerMom

Programmer
Oct 3, 2006
127
US
I have IE and 98% of the time I need to go to web site that requires me to log in as another user. Instead of constantly entering the alternate user/password, I'd like to configure IE so I can start it automatically as the other user. I'm aware of right-clicking the IE icon and choosing "Run as..." but I would like to avoid this too and configure it once to run as the other user whenever I start it.

Is there a way to do this?
Thanks...
 
You can create a batch file that will start IE using the runas command. Save it to your desktop or sompelace convenient. Then just double click to open IE with the other user credentials.
Code:
runas /savecred /user:[i]username[/i] "C:\Program Files\Internet Explorer\iexplore.exe"
Change username to whatever is appropriate. The first time that you run it, you'll need to enter the password for that alternate user account. A word of caution however- using the /savecred option is a potential security problem that you should consider depending on your circumstances. Once you do this, any other 'runas' commands using the /savecred option and that username will use the previously saved credentials. So if someone were to get access to that computer & run the command runas /savecred /user:username regedit.exe using the correct alternate username, no password prompt would be required. If you're OK with that possibility, then that should do it.
 
smah,

Thanks very much -- works great. Just one more question. I configured my home page in IE to be the site I want to go to (the one I use most of the time). For some reason when I use the bat file, it takes me to the other site.

Is there an additional parameter I can pass that specifies the site that I want displayed when IE starts?

Steve
 
Normally, a command line way to start IE & have it open to some particular site, you'd just add the url as a parameter to the program like:
Code:
"C:\Program Files\Internet Explorer\iexplore.exe" [URL unfurl="true"]http://www.tek-tips.com[/URL]
Adding this method to the runas command above to run as a different user gives us:
Code:
runas /savecred /user:[i]username[/i] "C:\Program Files\Internet Explorer\iexplore.exe" [URL unfurl="true"]http://www.tek-tips.com[/URL]
Sometimes, there seems to be problems when adding additional parameters like this with the runas command. Test it & see. If it doesn't work, there is another way around.
 
smah
I tried adding the url, but it does not work. What is the way around you mentioned?

thanks very much
 
That's what I figured. Sometimes it works; sometimes not. Anyway, the workaround is simply daisy chaining 2 batch files. The first would be simply to open IE with the required url. This could be saved anywhere on the computer (in the root of C: for example).
Code:
"C:\Program Files\Internet Explorer\iexplore.exe" [URL unfurl="true"]http://www.tek-tips.com[/URL]
Then, create a batch file using the runas command to change to the other user. This is the one that would be on the desktop (or wherever convienient). Instead of having this load IE directly, have it load the first batch file.
Code:
runas /savecred /user:[i]username[/i] C:\openpage.bat
 
Thanks.

I created the two batch files and configured them with my information. However, when I run the specialie.bat, I still get a dialog that prompts me for user name and password.

The dialog has a "Remember my password" checkbox, but when I check it and try the batch file again, I'm still prompted for password.

Any ideas?
 
are you sure the /savecred switch is correct and the username? If the username has a space, put quotation marks around it. As mentioned earlier- when using the /savecred switch, you should only be prompted for the password once.

I just tested the above & it works fine for me. However, I did notice one thing that I didn't mention. The 'specialie.bat' file must be located somewhere in the path that is accessible by the new user (the one specified in 'openpage.bat'). The file will not be accessible if it's anywhere in the current user's profile or any other place that the new user account doesn't have access to.
 
I double checked the username and it is correct. It is in a different domain than the domain for the current user. Would that make a difference?

Also, I put both bat files in a folder within C:\Program Files. Is that correct?

 
I would expect it to work with an alternate domain, but I don't have a way to test it. Hopefully for the /user switch, you used something like /user:user@domain or /user:domain\user.

I would stay away from the Program Files directory (at least until after successful testing). The Program Files directory sometimes has some strange behavior concerning user permissions.
 
smah,

Thanks for all your time on this. I specified user with the following:
/user:domain\user

I moved the folder containing the two bat files so it is in the C:\ directory, but I get the same behavior.

I'm not sure why it's not working, but I think it's time to move on, unless you have any other ideas.

Thanks again.

 
I have to admit that I'm out of ideas. I wonder why you're seeing this behavior. I have to suspect that it's related to the changing of domains. Just for fun, do you have another user account on the same domain to test with?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top