Sunday, October 21, 2012

Force software to always run as admin without exposing admin password

     
I have some software that only functions right if the person has administrative permissions on the machine. I don't want to give my users the admin passwords so they can do a Run As for obvious reasons.  Is there a way to force a program to run as administrator without exposing the admin password?

The answer is yes and can be achieved using a simple command and then creating a windows shortcut.

You can create and save the shortcut on any normal users desktop. You will have to configure to run the program as Administrator / Domain Admin account and it will save the password (don't worry it will be hidden)

User who wants admin rights to run any application can now be restricted as a normal user by this workaround.

runas /savecred /user:ComputerName\UserName "Full Path of Program"

or 

runas /savecred /user:Domain\UserName "Full Path of Program"

Example:

runas /savecred /user:ComputerName\UserName "c:\Program Files\CCleaner.exe"

Create a new windows shortcut and paste this command and save the shortcut on users desktop

Once you have the shortcut created, you will need to run the shortcut from the users profile and enter the admin password (one time so that savecred saves password).

From there the user should always be opening the program/application with admin rights and not be asked for a password. 

You can even change the icon for shortcut in properties screen.