Sonora Communications, Inc.

  • Increase font size
  • Default font size
  • Decrease font size

Using the Windows RunAs Function to Run a Program as a Regular User

E-mail Print PDF

To most system administrators, it is obvious that in this day and age, it is too dangerous to operate your PC as a privileged user such as 'administrator'.  However, there are many poorly-written applications that will not function properly without elevated privileges.

 

Here and here are links to discussions of this subject.

 

Here we will demonstrate how to run a program as a regular (non-privileged) user. 

 

Free Easy Burner (CD/DVD burning tool)

 

Programs that access hardware devices such as optical drives require special privileges in order to run.  This is sometimes dealt with by running a daemon (a program running in the background) whose entire purpose is to elevate the privileges of a program accessing the optical drive.  Most free programs don't have this extra layer and require an extra step to enable regular users to burn CDs.

 

You can download the Free Easy Burner tool here, then log in and install it as an an administrator.

 

Create a VBS Script

 

We will run Free Easy Burner as 'administrator', but you can choose any sufficiently-privileged user.

 

Create a text file.  We will name it FreeEasyBurner.vbs in this example.

set WshShell = CreateObject("WScript.Shell")
WshShell.Run "runas /user:administrator ""C:\Program Files\Free Easy Burner\FreeEasyBurner.exe"""
WScript.Sleep 100
WshShell.Sendkeys "password~"

Note that the tilde character after the password represents <enter>.

 

You can double-click this script to execute.

 

Encrypt the VBS Script 

 

You may not want the inquisitive poking around inside your VBS script where they will see the administrator password.  In this case, you can easily encrypt the file with a free tool from Microsoft.

 

Download the Windows Script Encoder here.

 

You encode the script with the following command.  The resulting .vbe file is executable.

"c:\program files\windows script encoder\screnc" "FreeEasyBurner.vbs" "FreeEasyBurner.vbe"

Last Updated on Sunday, 06 July 2008 17:42  

Your external IP

You are connecting to this site from: 38.107.179.232

Secure Client Login

Email Address:

Password: