Tip

PowerToys simplify dealing with elevating privileges in Windows Vista

I recently wrote about a way to add an Open Command Window Here as Administrator right-click context menu for folders in Windows Vista. I also recently read an article by Michael Murgolo that discusses a bunch of similar tools he had created

    Requires Free Membership to View

(based on scripting work done by Microsoft software design engineer John Stephens), but with broader functionality: a  set of "Elevation PowerToys."

These tools, as a group, are a way to make dealing with elevating privileges, or dealing with UAC, a little easier in Vista. Most, if not all, of what they address, is not handled very elegantly by default in Windows Vista. For instance, there's really no easy way to launch a process from a command line in Admin mode. All these tools, once installed, can be removed through the Add/Remove Programs menu.

The most basic of these tools is the Elevate Command PowerToy, in the form of a command-line executable (elevate.cmd), which can be invoked from the command line itself or from a script. Use the syntax elevate , and the requested command will be run as Administrator.

Note: Whenever you do this, you'll of course get a corresponding UAC prompt; you can't use this program to avoid the UAC dialog, which is deeply ingrained into the way Windows Vista behaves now. (It itpossible to toggle UAC off with a command-line action, but that in itself will require a UAC authentication!)

Another PowerToy in the kit is Run as Administrator for Scripts, which adds a right-click context menu for .VBS/.WSH scripts that lets you run them as administrator as well. The technique for doing this is essentially the same for elevating other file types as well, and Murgolo has included an example of how to do this for .MSI packages as well.

Note: If you try to install an .MSI package in Vista, you're going to get a UAC prompt anyway; this just pre-emptively authorizes the .MSI to run as admin and install without a prompt later on down the line.

Finally, there's a way to open command prompts, both as regular user and as admin, in any folder (again, as a right-click context menu) -- anda similar technique, used to open a Windows PowerShell prompt in any folder. Needless to say, the latter presupposes that you have PowerShell installed.

About the author: Serdar Yegulalp is editor of the Windows Insight, (formerly the Windows Power Users Newsletter), a blog site devoted to hints, tips, tricks and news for users and administrators of Windows NT, Windows 2000, Windows XP, Windows Server 2003 and Vista. He has more than 12 years of Windows experience under his belt, and contributes regularly to SearchWinComputing.com and SearchSQLServer.com.

More information on this topic:

This was first published in June 2007

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.