Reputation: 10476
I am running the following powershell command that works just fine if I run it from the machine itself. I am logging in as the same user that the continuous integration server runs with, but I get the following error from the CI Server:
New-PSSession : A positional parameter cannot be found that accepts argument
[18:19:47][Step 1/1] 'stage-web-01'.
[18:19:47][Step 1/1] At line:1 char:13
[18:19:47][Step 1/1] + $Sessions = New-PSSession –ComputerName $Servers
[18:19:47][Step 1/1] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[18:19:47][Step 1/1] + CategoryInfo : InvalidArgument: (:) [New-PSSession], ParameterB
[18:19:47][Step 1/1] indingException
[18:19:47][Step 1/1] + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell
[18:19:47][Step 1/1] .Commands.NewPSSessionCommand
Any thoughts on what I need to do differently from the CI Server? I checked and I'm running the same version locally as I am on the CI server.
Upvotes: 0
Views: 5476
Reputation: 11
This may not be your exact problem, but I ran into a similar problem, and turns out I had the character '–' and not '-' when I called parameters.
Wrong:
New-PSSession –ConfigurationName Microsoft.Exchange –ConnectionUri 'http://MYSERVER/PowerShell/' -credential $Credential
Right
New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri 'http://MYSERVER/PowerShell/' -credential $Credential
Upvotes: 1
Reputation: 10476
It's because of the Script execution mode -- I had to set it to be "Execute with "-File" argument.
Upvotes: 0