Unlock For Us

Universal RunAs Script Template in Elevating Commands as Administrator in Windows Vista

Can't Add a Command to Context Menu? How to run and elevate commands automatically using shortcuts or Context Menu in Windows Vista?

In Windows XP you can run any command easily, just type and launch. Life was easy... But we didn't think of the vulnerabilities that came and exploited several computers around the world.

Windows XP Vulnerabilities

I remember one time, somebody is having some fun with me that after restoring the original or manufacturers copy of Windows XP. An Adware type alert message (net send) was sent through Messenger Service remotely.

A friend of mine told me that her computer had worms, adware problems and hidden viruses since 2007 but she just ignored and lived with it until her Windows XP crashes and all the data was lost.

Problem with Windows Vista UAC

Most of us don't understand the great security feature of Windows Vista called User Account Control or simply UAC. If we will just open our mind and think in a broader way. You'll save a lot of time and money.

In every good feature there is always an effect; good or bad and in Vista that is called COMPLEXITY.

Examples:

From Simple Ways to Tweak your Network and Internet Connections

ipconfig /flushdns

The requested operation requires elevation.

From my article Hiding Computer Name from the Network Explorer:

net config server /hidden:yes

System error 5 has occurred.

Access is denied.

Note: If you'll run these commands one time only. To elevate, just type "cmd" in Start Search > press CTRL+Shift+Enter and type the command. that's it!

If you want to create a shortcut or add to Context Menu, it will not work because you need to elevate it first.

General Solution: Create a Universal Script that will Elevate any Command Automatically

1. Download WinBubbles, Extract and Open the Tools Folder

2. Create a Duplicate of the file "lawrence.vbs" by pressing CTRL and dragging the file into the same directory.

duplicatecopy

3. Rename the file to any file name that you want as long as it has a file extension of ".vbs"

example: hidethis.vbs

4. Open the File in the Notepad and modify the seventh line

objApp.shellExecute "cmd.exe", " /c CommandswithArguments" & chr(34) & strArg & chr(34), , "runas", 1

Now you have a template in creating Right-Click Menu Items with Command Elevation. Sweet!!!

Read, learn the examples below and Add them to your Context Menu using WinBubbles Context Menu Customization Tool.

CommandswithArguments Examples

attrib +h(space)        >>>...Click here for more Details

net config server /hidden:    >>> ...Click here for more Details

 

Another kind of Universal Script Template:

Switching using Parameters

objApp.shellExecute "cmd.exe", " /c  CommandswithArguments " & strArg & " Arguments", , "runas", 1

To understand, Please Read this Example: Click here

 

Learn more: How to Run VBScripts as Administrator in Windows Vista

Enjoy!

2 Comments:

flick said...

what other commands that needs elevation?

Lawrence Albert said...

Another Example

If you want to open the folder in Command Prompt as Administrator, Use this CommandwithParameter:

cmd.exe /s /k pushd(space)

 

© UnlockForUs 2007-2012| Blogger| Google.com | License Agreement