0

Is it possible to give a call to PowerShell Cmdlets in my VBScript?

I know how can I call entire Powershell Script, but instead I want to call some specific Cmdletes only. Also is it possible to get that result of Cmdlet to be stored in some Object in VBScript.

I don't have much idea about Powershell and VBScript. May be this is very question. Please let me know if you have idea how can we do this.

2 Answers 2

2

You can try ActiveXPosh (COM component) from Sapien. It is a special PowerShell host that allows developers/scripters to run single cmdlets or entire scripts from VBScript/JScript code. You can find it in the Downloads section under Free Components (registration needed, free):

http://www.sapien.com/blog/2008/06/25/activexposh-is-now-a-free-download/

Sign up to request clarification or add additional context in comments.

4 Comments

Thanks Shay for your quick reply. I would like to avoid use of third party tool as much as possible. Do you know any other way than ActiveXPosh?
Off the top of my head this is your only option.
The common theme in these answers is going to be that there is going to need to be some kind of interop interface / interim format. PowerShell is .NET object-based and VBScript is.. VBScript. Are you inheriting some old VBScript code? Otherwise, why use a mixed solution when PowerShell can pretty much do anything that VBScript can (or on flipside, just use VBScript)..?
Yes Daniel, I have a old VBScript Code to which I need to add few new features which are pretty easy with PowerShell. If you say Calling Script is the only option, Can you please suggest me how can I return a object from Powershell Script to my VBScript?
1

You could have PowerShell serialize objects to some sort of common format, like JSON or XML, and then import it in your VBscript. That's probably the best way to interoperate between VBscript and PowerShell.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.