Note that there are some explanatory texts on larger screens.

plurals
  1. POInvoke-Command powershell trouble
    text
    copied!<p><strong>Friend's i've got a trouble with this function, it will run on the remote server, but i've got the following output :</strong></p> <p><em>Invoke-Command : A positional parameter cannot be found that accepts argument '&amp; C:\testNunit\dll\'. At D:\test\Multithread.ps1:65 char:16 + Invoke-Command &lt;&lt;&lt;&lt; -ComputerName $serv -ScriptBlock $command ([ScriptBlock]::Create("&amp; $OneProject")) -credential $cred + CategoryInfo : InvalidArgument: (:) [Invoke-Command], ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.InvokeCommandCommand</em></p> <pre><code> function Nunit { ##Parse connection parameters $Connection = @{"server" = "..."; "username" = "..."; "password" = "...."} $serv = $connection.Get_Item("server") $user = $connection.Get_Item("username") $pass = $connection.Get_Item("password") $securePassword = ConvertTo-SecureString -AsPlainText $pass -Force #Create connection credentials object for Invoke-Command $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $user, $securePassword $NunitExe = "C:\testNunit\bin\nunit-console.exe" $OneProject = "C:\testNunit\dll\Foundation.Tests.dll" $TestProjects = "C:\testNunit\dll\" foreach( $OneProject in ( $TestProjects)) { $WorkingDir = "c:\testNunit" $NUnitOutput = "c:\testNunit" + $OneProject + ".xml" $command = {&amp;"$NunitExe" "$WorkingDir\$OneProject" \noshadow/framework:"net-3.5" /xml:$NUnitOutput} } Invoke-Command -ComputerName $serv -ScriptBlock $command ([ScriptBlock]::Create("&amp; $OneProject")) -credential $cred } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload