Step 2: RunAs command line

RunAs also comes in a console application that runs in the command shell and offers a variety of additional options, including whether to load the profile, whether to use credentials only for network authentication. If you choose net only you continue to run as the same user locally, but whenever you authenticate on the network using Windows integrated authentication it uses the credentials you specify. You can also use this to authenticate using a smart card. So you can enter a smart card pin instead of a user name and password and it will get the user account information from the smart card instead.

An example command: runas /u:Administrator cmd.exe

Another option available to the command line is SaveCred. SaveCred allows you to save a password for that account and then reuse it later. This option is very misunderstood. A lot of people believe they can set up a shortcut that uses SaveCred so that they can allow a user to run just one specific program with admin credentials and only that program. The problem is that when SaveCred saves the credentials it saves it for whenever RunAs invokes that user account. So if you create a shortcut for a user that allows them to run one specific program and you are using SaveCred they could use RunAs/SaveCred to run something else also as admin. This could potentially create a security hole.

Personally, I don't use that option. I prefer entering the password whenever I need to run something as admin.

Elevating privileges for administrators

 Home: Introduction
 Step 1: RunAs dialog
 Step 2: RunAs command line
 Step 3: Differentiating security levels
 Step 4: MakeMeAdmin
 Step 5: Caveats
 Step 6: Resources

Aaron Margosis is a Senior Consultant with Microsoft Consulting Services, focusing on US Federal government customers. He specializes in application development on Microsoft platforms and products with an emphasis on application and platform security. Aaron has blogged extensively about how to run Windows as a non-admin, and created the popular MakeMeAdmin and PrivBar utilities. Aaron holds Bachelors and Masters Degrees from the University of Virginia, and calls Arlington, VA, home.
Copyright 2005 TechTarget

This was first published in April 2006

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.