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

"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

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

 

Thanks,

Om

Suggest an answer

Log in or Join to answer
Community showcase
Renan Battaglin
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...

1,064 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot