Add Run as administrator context menu item to VBS files

User Account Control (UAC)

There are not many cases when you need to execute a VBS script (*.vbs file) as Administrator. But when you need it, it can be tricky. Instead of just double clicking a VBScript, you need to open an elevated command prompt and type the name of the VB script file at the correct path to execute the script as admin. To avoid this, you can add a context menu command for VBS files to the File Explorer app which will allow you to run the selected VBS file as administrator. Here is how.

This can be done with a simple Registry tweak. Follow the instructions below.

  1. Open Registry Editor.
  2. Go to the following Registry key:

    Tip: You can access any desired Registry key with one click.
    If you have no such Registry key, then just create it.

  3. Create here a new subkey named "runas". You will get
  4. Under the runas subkey, create a new string value named HasLUAShield. Don't set its value data, leave it empty. This value is only required to add the UAC icon to the context menu item you are creating. You should get it as follows:
  5. Under the runas subkey, create a new subkey called "command". You will get the following path:

    Set the default parameter of the command subkey to the following text:

    C:\Windows\System32\WScript.exe "%1" %*

    You will get something like this:

Now right click any *.vbs file to test the context menu item:

A UAC prompt will appear.

You are done. To undo this change, delete the mentioned "runas" subkey.

The same can be done using Winaero Tweaker. Go to Context Menu -> Run as Administrator:
Use this option to avoid Registry editing.

Also, I made ready-to-use Registry files, so you can avoid manual Registry editing. An undo file is also included.

Download Registry files

That's it.

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!

Author: Sergey Tkachenko

Sergey Tkachenko is a software developer who started Winaero back in 2011. On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram, Twitter, and YouTube.

3 thoughts on “Add Run as administrator context menu item to VBS files”

  1. Thank you, thank you, thank you and thank you one thousand times! We’ve been suffering with a .vbs file that needed admin permits in order to run correctly, we tried so many alternatives until found this one and it worked as a charm! Once again thank you for taking the time to explain with such detail.

Leave a Reply

Your email address will not be published.

Exit mobile version
Using Telegram? Subscribe to the blog channel!
Hello. Add your message here.