Scripting elevation in Windows Vista with JavaScript

This scripting technique allows you to elevate a given process to Admin. It involves creating a script—written in JavaScript—that can be placed in your user's PATH and invoked from the command line like a regular command.

Recently I've discussed several techniques to elevate a process to the Administrator level in Windows Vista. All these techniques (including the one I'm about to mention) require that the user approve the UAC dialog that appears when the process is elevated. This is just the way process elevation works in Windows Vista.

By submitting your personal information, you agree to receive emails regarding relevant products and special offers from TechTarget and its partners. You also agree that your personal information may be transferred and processed in the United States, and that you have read and agree to the Terms of Use and the Privacy Policy.

In this tip I will pass on a technique courtesy of one of the people I rely on the most to get the straight dope about privilege elevation and least-privilege issues in Windows: Aaron Margosis.

A member of Microsoft Consulting Services, Aaron created a utility called LUA Buglight. This tool helps administrators (as well as programmers) identify potential problems with applications that were due to the app not working right when it was run with a Limited User Account (LUA), as opposed to an admin user account.

Aaron has posted a scripting technique that allows you to elevate to admin any given process, from the command line or in a script. The trick involves creating a script—written in JavaScript—that can then be placed in your user's PATH (i.e., any directory mapped in the PATH variable) and invoked from the command line like a regular command. Activate a command with this script, and the UAC prompt will appear as it would if you'd manually launched the program as admin.

One advantage to using Aaron's elevate.js script is that, because it's a script and not a compiled executable, you can make any modifications you want to it to fit a particular setting. And you can do this without the hassle of recompiling it; changes can be tested immediately.

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.

E-Chapter

0 comments

E-Mail

Username / Password

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