Question

In order to automate test releases, I need access to remote computer in other domain group. What I've done on remote computer:

  1. run Enable-PSRemoting
  2. set TrustedHosts "*"
  3. added https listener with self-signed certificate
  4. opened 5985 and 5986 ports

So now scripts are running successfuly via PowerShell console. But when I'm trying to run remote script via TeamCity agent I've been receiving following error:

Connecting to remote server failed with the following error message :
Access is denied. For more information, see the
about_Remote_Troubleshooting Help topic.

TeamCity agent service is running with Local System rights.

Session initialization

$password = ConvertTo-SecureString $appServerPwd -AsPlainText -Force 
$appCred = New-Object System.Management.Automation.PsCredential($appServerUser,$password)
$rs = New-PSSession -ComputerName $appServer -Credential $appCred -UseSSL -SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck) -Authentication Negotiate

Also when I'm trying to make remote call to domain computer via TeamCity everything works. Do you have any idea how to solve this issue ?

Dima

Was it helpful?

Solution

I've found the problem, as soon I changed "Local System" user to Administrator user on TeamCity agent service, everything started to work. So the issues was in rights (starting PSSesion) between "Local System" and Administrator.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top