簡體   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