Problem solve Get help with specific problems with your technologies, process and projects.

More on the RUNAS command

A small console mode application that is run via a desktop link/icon and invokes a specific admin-level program.

This tip was submitted to the tip exchange by member Robert Phillips. Please let other users know how useful it is by rating it below.

This is an extension of Tom Lancaster's tip "Try the RUNAS Command." In addition to everything Mr. Lancaster states, I find even the repetitive use of the RunAs to be a pain at times, such as when I am visiting several users workstations, or when I am doing development on my own machine in user mode in order to test an application I'm writing and need to routinely access admin-level tools.

I wrote a small console mode application that is run via a desktop link/icon and invokes a specific admin-level program. It is for me only and not for users. I copy it to a network location and use it when at user stations, then delete it when through. I leave the links available on my own station on the user-level desktop. I can run MMC or start a VB session while logged on at a user level. I don't need to keep retyping the user name, password and application path every time. This is an admin only tool and care should be taken not to leave it accessible to your standard users.

The application is small (44k) and requires you to know the admin user name, password and the path to the application you want to run. If you don't know the name and password, the RunAs command will fail. This app does not attempt to guess a password. It is not a crack. It is only an administrative helper.

This app creates a small data file that contains minimally encrypted name, password and application path. The data file resides in the same directory as this app. No other files are needed, other than creating a shortcut, to invoke this app and pass it the name of the data file it should use to feed the RunAs command in a console session.

The app is named bobsrun.exe but you can call it anything you like. Invoking bobsrun.exe with no modifier starts bobsrun in 'create data file' mode. You provide the admin name, password, application path and a file name (no extension) for the data file [ .dat extension applied by default].

Invoking in the following way will tell bobsrun to feed the RunAs command with data from an encrypted file named 'test.dat': k:tempbobsrun.exe /r test.

This app has only been tested in XP. It may work on Win2k, but NT is definitely out. There is a possibility that timing issues on some machines may cause this method to fail due to an extended time delay in getting the RunAs command activated to receive keystrokes. The keystrokes will essentially fall on deaf ears and RunAs will have only received partial command strings. But for the rest of the machines, it sure is a time saver.

You should save the file in a temp directory on a standalone machine. I was not pleased with XP, the phone-home mentaility, nor the MS licensing schemes, and my sentiments were included in the app by a small departing comment in the DOS screen before the DOS session closes. If that is more than you can bear, I intend to recompile the app and change the feedback line to something like 'Success.'

Click here to open a zip file from which you can download this program.

Dig Deeper on Windows client management

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.