"Invoke-Command " in powershell script doesn't work from bamboo plan invocation.
I have a script task (Run as Powershell script) that invoce powershell file with some parameter.
And magik is that it failed on line when i try to Invoke-Command -ComputerName ... on remote host with credentils previously created. Code powershell like this:
>>>>>>>>>>>>>>>>>>>>>>>>>
$cred = New-Object System.Management.Automation.PSCredential -ArgumentList @($ServiceUser,(ConvertTo-SecureString -String $ServicePassword -AsPlainText -Force))
Invoke-Command -ComputerName $serverName -ArgumentList $force,$WebAppPoolName,$ManagedRunTimeVersion -Credential $cred -ScriptBlock {
some actions .... }
>>>>>>>>>>>>>>>>>>>>>>>>>
And bamboo task is failed with error:
| 5:05 |
Invoke-Command : An internal error occurred. |
| 04-Dec-2013 20:45:05 |
At C:\build-dir\QOIP-QI-JOB1\CIAF\Bamboo\PS\ConfigureIIS.ps1:56 char:15 |
| 04-Dec-2013 20:45:05 |
+ Invoke-Command <<<< -ComputerName $serverName -ArgumentList $force,$WebAppPo |
| 04-Dec-2013 20:45:05 |
olName,$ManagedRunTimeVersion -Credential $cred -ScriptBlock { |
| 04-Dec-2013 20:45:05 |
+ CategoryInfo : InvalidOperation: (:) [Invoke-Command], PSInvali |
| 04-Dec-2013 20:45:05 |
dOperationException |
| 04-Dec-2013 20:45:05 |
+ FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.I |
| 04-Dec-2013 20:45:05 |
nvokeCommandCommand
|
But magik is that when i run the same powershell scrip on bamboo instance manualy with the same parameters and under the same "Bamboo" user i didn't recived such error and this script work correctly.
So this issue reproduced only when try to run powershel stuff by bamboo and for command Invoke-Command when trying to do something on remote host under appropriate permissions.
Any suggestion how to fix this issue ?