Supplied parameter is not recognized?
<p>I'm trying to import a module then execute it.</p>

<p>If I do this in powershell prompt, it works.</p>

<pre><code>. "Z:\shm\Invoke-Runas.ps1"
Invoke-Runas -User a -Password a -Binary C:\Windows\System32\cmd.exe -LoginType 0x1
</code></pre>

<p>However if I use a one liner, I got an error:</p>

<pre><code>powershell -ep bypass . "Z:\shm\Invoke-Runas.ps1" ; Invoke-Runas -User a -Password a -Binary C:\Windows\System32\cmd.exe -LoginType 0x1

Invoke-Runas : A parameter cannot be found that matches parameter name 'LoginTy
pe'.
At line:1 char:108
+ . Z:\shm\Invoke-Runas.ps1 ; Invoke-Runas -User a -Password a -Binary C:\Windo
ws\System32\cmd.exe -LoginType &lt;&lt;&lt;&lt;  0x1
    + CategoryInfo          : InvalidArgument: (:) [Invoke-Runas], ParameterBi
   ndingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Invoke-Runas
</code></pre>

<p>It looks like the previous command ate all parameters, am I wrong?</p>

<p><a href="https://github.com/FuzzySecurity/PowerShell-Suite/blob/master/Invoke-Runas.ps1" rel="nofollow noreferrer">The source code is here</a></p>