How to Use VBScript to Run a PowerShell Script
FIM ScriptBox Item
Summary
If you you want to run a PowerShell script by just double-clicking it, you can do this calling the PowerShell script from a VBScript.
The VBScript code below shows an example for this.
To use the VBScript, save the VBS file in the folder where your PowerShell script is assign the name of your PowerShell script to the VBScript (with a .vbs extension) .
Note
If you want to use a VBScript to run a PowerShell script, you need to enable this by setting the "executionpolicy" parameter on your computer.
To do this, start PowerShell, and then type "set-executionpolicy unrestricted".
For more details, see Using the Set-ExecutionPolicy Cmdlet.
Script Code
Option Explicit
Dim oShell, appCmd
Set oShell = CreateObject("WScript.Shell")
appCmd = "powershell -noexit &'" & Replace(WScript.ScriptFullName, ".vbs", ".ps1") & "'"
oShell.Run appCmd, 4, false
Note
To provide feedback about this script, create a post on the FIM TechNet Forum.
For more FIM related Windows PowerShell scripts, see the FIM ScriptBox.