Site icon Automation Dojos

How To Auto-launch VBscript with Elevated Privileges

For cases when you need to execute a VBS script (*.vbs file) as admin with elevated privileges you can try the following snippet. This can be done by running ShellExecute and setting the runas flag to run an executable or to run an entire script (batch file or VBScript) with elevated permissions. You can copy/embed the following snippet into your vbscript file or batch file. This should result in executing your script as admin just by double-clicking it.

Caution: Please use this carefully. Make sure your VBScript or batch file is correct and serves the intended purpose only because whatever your script contains will be executed as ‘Admin’
Exit mobile version