Tuesday, September 18, 2018

windows - Internet Explorer 8 "Run with different credentials" shortcut - batch script option?



Internet Explorer 8, combined with Windows 7, offer the possibility to open IE by specifying which user account will be used for security. This can be done by shift right clicking the IE shortcut and selecting "Run with different credentials". This option then opens a windows message-box asking for a username and password that will be used as credentials in the instance of IE.



My question is: Is it possible to create an IE shortcut that will pop this windows message-box and ask for credentials at every opening?



To put you in context, we have generic security usernames that are used on some specific laptops who do not require login at startup. Those accounts have limited access, but sometimes the person using those accounts needs to consult a website that requires higher privileges. We want the user to be able to login to IE with a different account to access the website without logging off Windows.




So far, I have tried using a .bat to get username and then use runas.exe:



set INPUT=
set /P INPUT=Username: %=%
C:\Windows\System32\runas.exe /user:myDomain\%INPUT% "C:\Program Files (x86)\Internet Explorer\iexplore.exe "www.google.com""


But this option opens a console and I would like to get the windows messagebox...




I also tried with PowerShell:



Start-Process -FilePath "C:\Program Files (x86)\Internet Explorer\iexplore.exe "www.google.com"" -Credential (Get-Credential)


But this option required PowerShell on every laptop (many) and the users must specify the Domain to login which is not an option...



How can I simply get the windows security messagebox to pop up?


Answer



If you don't mind using a utility, check out ShellRunAs from Microsoft, it does what you're looking for:





The command-line Runas utility is handy for launching programs under
different accounts, but it’s not convenient if you’re a heavy Explorer
user. ShellRunas provides functionality similar to that of Runas to
launch programs as a different user via a convenient shell
context-menu entry.



No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...