How to allow VB scripts to run on an admin account

Solution 1:

the way I normally do this is to stick the following code at the top of my script:

If Not WScript.Arguments.Named.Exists("elevate") Then
  CreateObject("Shell.Application").ShellExecute WScript.FullName _
    , WScript.ScriptFullName & " /elevate", "", "runas", 1
  WScript.Quit
End If

This way, if I launch the VBS as a non admin - it tries to run, notices I'm not an admin and then relaunches - prompting me to run as admin and away we go.

I know its a pain, but its a fairly simple solution.

Hope this helps