Using Windows PowerShell from VBScript, JScript
Sapien Technologies has made available ActiveX PowerShell (ActiveXPosh), a free scripting tool which allows calling the Windows PowerShell from any COM compatible scripting language like VBScript or JScript. ActiveXPosh is useful to enhance existing scripts to make use of the PowerShell functionality.
Sapien describes ActiveXPosh as following:
A COM component that can be used from VBScript, JScript, KiXtart, or any other COM-compatible language. Allows you to create a direct Powershell host and use cmdlets and scripts from within your favorite scripting language. Multiple output options make integration flexible.
An example of using ActiveXPosh can be found in the description document provided by Sapien:
Set ActiveXPosh = CreateObject("SAPIEN.ActiveXPosh")
if ActiveXPosh.Eval("Get-Process Winword") = vbTrue Then
WScript.Echo "Word is running"
Else
WScript.Echo "Word is NOT running"
End If
The tool's interface is made up from the following commands:
- ClearOutput() - This method clears the internal output buffer.
- Execute(strcommand) - Executes a PowerShell command or script.
- Eval(strExpression) - Evaluates a PowerShell expression.
- Init(execProfile) - Initial call to instantiate a PowerShell engine.
- IsPowerShellInstalled - Returns True/False.
- Output - A collection of strings filled with output from
PowerShell commands. - OutputString - The content of the output buffer as a single string.
- OutputMode - Sets or gets the current output mode.
- OutputWidth - Sets or gets the desired output width.
ActiveXPosh is offered with other free scripting tools under the Free Tools Universal License Agreement.
Educational Content
Large-Scale Continuous Testing in the Cloud
John Penix May 24, 2013
Managing Build Jobs for Continuous Delivery
Martin Peston May 24, 2013
Clojure in the Field
Stuart Halloway May 23, 2013




Hello stranger!
You need to Register an InfoQ account or Login to post comments. But there's so much more behind being registered.Get the most out of the InfoQ experience.
Tell us what you think