简体   繁体   English

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

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

I am executing a powershell script on a target machine using Azure DevOps release pipeline (which uses PSSession) and I have got the following error:我正在使用 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

what am I missing here?我在这里想念什么?

Update 1:更新1:

I logged into the NewDBServer using the credentials that I mentioned in the DevOps and task.我使用 DevOps 和任务中提到的凭据登录到 NewDBServer。 This is what I got:这就是我得到的:

在此处输入图像描述

Don't know how helpful it will be however I sent the protocol to HTTP instead of HTTPS.不知道它会有多大帮助,但是我将协议发送到 HTTP 而不是 HTTPS。 So port 5985 was used and there were no issues.因此使用了端口 5985 并且没有问题。

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

相关问题 Powershell 来自 azure 管道的目标计算机 - Powershell on target machines from azure pipelines Azure Pipelines Environment变量不适用于目标计算机上的PowerShell - Azure Pipelines Environment variables not working for PowerShell on Target Machines 在Azure Powershell中执行Get-AzureStorageAccount时出错 - Error when executing Get-AzureStorageAccount in azure powershell 执行powershell时Kudu REST API命令端点错误 - Kudu REST API Command endpoint error when executing powershell 使用Powershell的经典计算机的Azure计费 - Azure Billing for Classic machines Using Powershell 使用azurerm_virtual_machine_extension时,PowerShell脚本未执行 - PowerShell Script is not executing when using azurerm_virtual_machine_extension 使用 azure devops 在特定机器上部署时,我可以只针对 Pilot run 机器并发布其他机器吗? - While deploying on specific machines using azure devops can I only target Pilot run machines & post that other machines? 远程PowerShell至AzureRM虚拟机 - Remote PowerShell to AzureRM Virtual Machines 在Linux上的Powershell中使用服务主体登录时出错 - Error when login using service principal in Powershell on Linux 使用Powershell为Stream Analytics创建blob存储输出时出错 - Error when creating a blob storage output for Stream Analytics using Powershell
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM