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:
- run Enable-PSRemoting
- set TrustedHosts "*"
- added https listener with self-signed certificate
- 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.
精彩评论