Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am running a kiosk type system where the user has almost zero permissions.

I want to place an icon on their desktop that would run a specific program as their Active Directory credentials. I am familiar with SysInternals ShellRunAs, but it would require a right-click which means retraining users.

Could I accomplish this by having them double-click on the icon that they normally would and they would get a prompt for username/password and then execute the program as that?

share|improve this question
up vote 7 down vote accepted

If PowerShell is an option for you, a PowerShell script can prompt for credentials and then use those credentials to start a process.

Start-Process -FilePath "C:\Windows\notepad.exe" -Credential (Get-Credential)

The user sees this prompt, and then the process is started.

enter image description here

share|improve this answer
Perfect! I think I will give this a shot. – Raymond Jan 16 '12 at 20:50

ShellRunAs doesn't strictly require a right-click; it can be (and in fact is) called as an ordinary tool with the original program given in the command-line – just like the built-in runas but graphical.

shellrunas notepad foo.txt

This could be used in a shortcut.

share|improve this answer

You can modify the shortcut to use the command-line RunAs utility. For example, here's the target of a shortcut that will try to open a specific folder in explorer as the user BillyBob:

C:\Windows\System32\runas.exe /user:BillyBob "Explorer.exe F:\Projects"

The /user argument can also accept domain credentials (either hard-coded, or using the %USERDOMAIN% environment variable:

C:\Windows\System32\runas.exe /user:%USERDOMAIN%\BillyBob "Explorer.exe F:\Projects"\BillyBob "Explorer.exe F:\Projects"

The username can be an assigned to the %username% environment variable:

C:\Windows\System32\runas.exe /user:%username% "Explorer.exe F:\Projects"

Or, with both the domain and username coming from the environment:

C:\Windows\System32\runas.exe /user:%USERDOMAIN%\%username% "Explorer.exe F:\Projects"

Once the shortcut is opened, a cmd.exe window will show asking for the password of the specified account:Password Prompt

If you need the user to enter a username, then things get a little hackish and you have to put this in a .bat file:

@Echo Off

set INPUT=
set /P INPUT=Username: %=%
C:\Windows\System32\runas.exe /user:%INPUT% "Explorer.exe F:\Projects"
share|improve this answer
The problem is that many different users will need to run the icon, so I can't hardcode "/user:BillyBob" – Raymond Jan 16 '12 at 20:49
You can also use the %username% environment variable in the target. i.e. /user:%username% – Andrew Lambert Jan 16 '12 at 20:52
@Ray B I've edited my answer to demonstrate domain logins and variable usernames. – Andrew Lambert Jan 16 '12 at 21:01
Still wouldn't work, it has to prompt for the username as well. The logged in user will always be the kiosk user, not the operator. – Raymond Jan 16 '12 at 21:36
@Ray B I added getting user input at the bottom. At this point, though, it's just cleaner to use PowerShell like Patrick S. suggested. I offer it in case someone wants to have this kind of thing without installing PowerShell. – Andrew Lambert Jan 16 '12 at 22:07

This is my way to do it:

@echo off
rem @--------Window config
mode con cols=60 lines=10
rem @--------Authentication
@set /p user=Username:
@runas /user:%user% "C:\Programas\Internet Explorer\IEXPLORE.EXE"

rem @ if you are in a domain use:
rem @runas /user:DOMAIN\%user% "C:\Programas\Internet Explorer\IEXPLORE.EXE"

rem @---------Window close time (after "-n" put window close time in seconds)
ping -n 3>NUL


You can test it and it will work fine.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .