开发者

PowerShell remote call. Access is denied

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 run开发者_Python百科ning 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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜