title: call Powershell in VBS with parameters
body: <p>I need one, simple thing. I am using VBS to call Powershell and I like to execute it with parameter (variable from VBS)</p>
  <blockquote>
  <p>Dim Input</p>
  <p>Input = InputBox(&quot;Enter User's alias to check&quot;)<br />
  Set objShell = CreateObject(&quot;Wscript.Shell&quot;)</p>
  <p>objShell.run(&quot;powershell.exe -noexit -file .\ps_v2.ps1&quot;) &amp;Input</p>
  </blockquote>
  <p>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.</p>
  <p>In PS console i just type</p>
  <blockquote>
  <p>.\ps_V2.ps1 Input</p>
  </blockquote>
  <p>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.</p>
  <p>Result is that PowerShell window appear just for a second and disappear. I think it is not taking &quot;Input&quot; in consideration at all.</p>
  <p>So make long story short. How should look the VBS line to call PS script with argument? Just like &quot;.\ps_V2.ps1 Input&quot; in PS console.</p>
  <p>Thanks a lot in advance!</p>
  <p>Edited: 19.2.2014 - 16:32
  <strong>Thank You Ekkehard.Horner, works fine</strong></p>