Call a ps1 script with parameters from a VBS script

502 Views Asked by At

All my users are using a VBS-based login script. At the end of the script, I want to call a PS1 with parameters that change the contents of the informational balloon.

How should VBS call a PS1 with parameters?

1

There are 1 best solutions below

0
Angshuman Agarwal On

Jeffrey Snover has the answer it seems - http://blogs.msdn.com/b/powershell/archive/2008/07/25/invoking-powershell-from-vbscript-com.aspx

Excerpt from the blog -

With ActiveXPosh you can do things like:

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

Pretty simple stuff! So - how could it get any better? Yup - you guessed it, ActiveXPosh is FREE. Is this a wonderful world or what?

NOTE- I have not tried though.