"Invoke-Command " in powershell script doesn't work when invoke it from bamboo task only

Andrey AndreySh December 3, 2013

"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 ?

2 answers

0 votes
Andrey AndreySh November 24, 2016

No i didn't

0 votes
Omprakash Thamsetty
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 7, 2016

Did you found the solution for this? I am having the same issue.

 

Thanks,

Om

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events