为了自动化测试版本,我需要访问其他域组中的远程计算机。
我在远程计算机上完成的操作:
因此,现在脚本可以通过PowerShell控制台成功运行。
但是,当我尝试通过TeamCity代理运行远程脚本时,出现以下错误:
Connecting to remote server failed with the following error message :
Access is denied. For more information, see the
about_Remote_Troubleshooting Help topic.
TeamCity代理服务正在使用本地系统权限运行。
session 初始化
$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
另外,当我尝试通过TeamCity远程调用域计算机时,一切正常。
您知道如何解决此问题吗?
迪玛
最佳答案
我发现了问题,将TeamCity代理服务上的“本地系统”用户更改为管理员用户后,一切开始正常工作。
因此,问题出在“本地系统”和管理员之间的权限(启动PSSesion)上。
关于powershell - PowerShell远程调用。拒绝访问,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7309776/