How to Run a PowerShell script inside a VBS script

To Run a PowerShell script inside a vbs script can be usefull for many reasons, and its a quick and dirty way to run PowerShell scripts in environments where execution policy normally stops you from running your scripts. A vbs wrapper script is what I use to launch PowerShell scripts in those scenarios.

This is the vbs wrapper i use to run PowerShell scripts.

Wrapper.vbs

Set objShell = CreateObject("Wscript.shell")
objShell.run("powershell -Executionpolicy Bypass -nologo -noninteractive -file .\script.ps1 -parameter Example")

Execute: cscript Wrapper.vbs

Note: You can also use this vbs script to run other vbs scripts inside the vbs script.

Ed Wilson (Microsofts scripting guy) also have a blog post about using vbscripts to run PowerShell. https://blogs.technet.microsoft.com/heyscriptingguy/2012/07/18/how-to-use-vbscript-to-run-a-powershell-script/

Anders Rødland

Anders Rødland started his IT career in 2006. My main focus is MS Configuration Manager and client management, and I currently hold active 15 Microsoft certifications. Certified on Windows Server, Windows Client, SQL, Exchange and System Center Configuration Manager. Anders Rødland also holds an ITIL Foundation certification. This is my private blog and do not represent my employer. I use this to share information that I find useful. Sharing is caring.