How to utilize Powershell inside of a VBScript


Using a third party COM component called ActiveXPosh (Registration to Sapien required to download. Download under their free section), you can use Powershell to gather data and pass it into a VBScript or any other COM language that is compatible with ActiveXPosh.

Here is an example of how a PowerShell script can be called within a VBScript:

Set ActiveXPosh = CreateObject("SAPIEN.ActiveXPosh")
if ActiveXPosh.Eval("Get-JAMSVariable MyVariable -ValueOnly") = 1 Then
WScript.Echo "Value is 1"
WScript.Echo "Value is NOT 1"
End If

An example of this usage in JAMS would be to use Get-JAMSCredential to return User data into a VBScript, or to use Get-JAMSVariable.

MSDN Blog Entry for ActiveXPosh

ActiveXPosh Whitepaper

Have more questions? Submit a request