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?


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

  • Perfect! I think I will give this a shot. – Raymond Jan 16 '12 at 20:50
  • I had to use full paths: Start-Process -FilePath "C:\Windows\System32\WindowsPowerShell\v1.0\powershell_ISE.exe" -Credential (Get-Credential) -WorkingDirectory "C:\Windows\System32\WindowsPowerShell\v1.0" and it also opened it in new window, which is a little extra. – Michele Mar 12 at 19:38
  • You’re starting a new instance of the ISE. Of course it’s going to open a new window. – Patrick Seymour 2 days ago

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"
  • 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

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.


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 http://www.google.com"

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

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.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.