I need one, simple thing. I am using VBS to call Powershell and I like to execute it with parameter (variable from VBS)
Dim Input
Input = InputBox("Enter User's alias to check")
Set objShell = CreateObject("Wscript.Shell")objShell.run("powershell.exe -noexit -file .\ps_v2.ps1") &Input
As you see it is pretty short and easy code, PS_v2.ps1 works fine when executed in PS console directly with argument. I need variable Input to be used as parameter.
In PS console i just type
.\ps_V2.ps1 Input
and it works. So it must be somewhere in ObjShell.run. When I used echo just to check if the variable is assigned correctly i got a correct output.
Result is that PowerShell window appear just for a second and disappear. I think it is not taking "Input" in consideration at all.
So make long story short. How should look the VBS line to call PS script with argument? Just like ".\ps_V2.ps1 Input" in PS console.
Thanks a lot in advance!
Edited: 19.2.2014 - 16:32 Thank You Ekkehard.Horner, works fine