繁体   English   中英

使用 PSSession 在目标计算机上执行 PowerShell 时出错

[英]Error when executing PowerShell on target machines using PSSession

我正在使用 Azure DevOps 发布管道(使用 PSSession)在目标机器上执行 powershell 脚本,但出现以下错误:

2022-06-17T12:27:22.1621620Z ##[section]Starting: PowerShell Script - Backup Temp DB
2022-06-17T12:27:22.2530275Z ==============================================================================
2022-06-17T12:27:22.2530704Z Task         : PowerShell on target machines
2022-06-17T12:27:22.2531137Z Description  : Execute PowerShell scripts on remote machines using PSSession and Invoke-Command for remoting
2022-06-17T12:27:22.2531501Z Version      : 3.200.0
2022-06-17T12:27:22.2531752Z Author       : Microsoft Corporation
2022-06-17T12:27:22.2532172Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/powershell-on-target-machines
2022-06-17T12:27:22.2532638Z ==============================================================================
2022-06-17T12:29:58.1951592Z ##[error]Unable to create pssession. Error: 'Connecting to remote server NewDBServer.XYZ.local failed with the following error message : WinRM cannot complete the operation. Verify that the specified computer name is valid, that the computer is accessible over the network, and that a firewall exception for the WinRM service is enabled and allows access from this computer. By default, the WinRM firewall exception for public profiles limits access to remote computers within the same local subnet. For more information, see the about_Remote_Troubleshooting Help topic.'
2022-06-17T12:30:19.4281448Z ##[error]The remote session query failed for NewDBServer.XYZ.local with the following error message: WinRM cannot complete the operation. Verify that the specified computer name is valid, that the computer is accessible over the network, and that a firewall exception for the WinRM service is enabled and allows access from this computer. By default, the WinRM firewall exception for public profiles limits access to remote computers within the same local subnet. 
2022-06-17T12:30:19.4694522Z ##[error]PSSession could not be created for Machine:'NewDBServer.XYZ.local:5986'
2022-06-17T12:30:19.5266279Z ##[section]Finishing: PowerShell Script - Backup Temp DB

我在这里想念什么?

更新1:

我使用 DevOps 和任务中提到的凭据登录到 NewDBServer。 这就是我得到的:

在此处输入图像描述

不知道它会有多大帮助,但是我将协议发送到 HTTP 而不是 HTTPS。 因此使用了端口 5985 并且没有问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM