Tip

More on the RUNAS command

This tip was submitted to the SearchWin2000.com 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."

    Requires Free Membership to View

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.
 

This was first published in April 2003

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.