AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题

问题[winrm](server)

Martin Hope
TMacie
Asked: 2022-01-26 10:51:18 +0800 CST

Exchange 2013 PowerShell EMS 不工作

  • 0

在本地 2013 服务器(或远程)上打开 EMS 时出现以下错误。直到最近 EMS 一直运行良好,我不确定是什么导致了问题。我已经阅读了许多文章和论坛帖子,但没有一个建议奏效。

谢谢,

特拉维斯

错误:

 New-PSSession : [servername] Connecting to remote server servername failed with the
following error message : The WinRM client sent a request to an HTTP server and got a response saying the requested
HTTP URL was not available. This is usually returned by a HTTP server that does not support the WS-Management
protocol. For more information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:1
+ New-PSSession -ConnectionURI "$connectionUri" -ConfigurationName Microsoft.Excha ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotin
gTransportException
+ FullyQualifiedErrorId : URLNotAvailable,PSSessionOpenFailed
exchange powershell winrm exchange-2013
  • 2 个回答
  • 215 Views
Martin Hope
Paul
Asked: 2021-01-12 08:57:24 +0800 CST

在没有 Windows 域的情况下通过 https 转发 Windows 事件 - 没有事件 104

  • 1

按照此答案中的建议,我正在尝试按照此 Microsoft 指南设置 Windows 事件转发:

设置事件源与事件收集器计算机不在同一个域中的源启动订阅。

我坚持了好几天,并且已经阅读了数十次本指南,每隔一段时间就会克服另一个小障碍。我已经走了很远,但现在我感觉真的被困住了。

我被困在事件源计算机配置的第 7 点:

  1. 这些步骤应在您的源计算机事件查看器应用程序和服务日志\Microsoft\Windows\Eventlog-ForwardingPlugin\Operational 日志中生成事件 104,并显示以下消息:
    “转发器已成功连接到地址处的订阅管理器,随后是事件 100消息:“订阅 <sub_name> 已成功创建。”
  2. 在事件收集器上,订阅运行时状态现在将显示 1 台活动计算机。

我也不确定第 8 点是什么意思。对于订阅运行时状态命令 ( wecutil gr SubscriptionId),我需要一个订阅 ID,但指南没有告诉创建一个。

我很困惑。你能指出我正确的方向吗?谢谢。

windows windows-event-log eventviewer winrm
  • 1 个回答
  • 533 Views
Martin Hope
Wellington Oliveira
Asked: 2020-12-03 13:42:59 +0800 CST

Ansible 和 Windows Server 之间的连接超时

  • 0

我从 Ansible 开始我的学习,并希望将其应用到我工作的实际情况中。我正在从 Ubuntu 实施 Ansible 来管理 Windows Nano Server 2016。我正在配置使用映射到用户帐户的证书。我在这里建立了本教程https://adamtheautomator.com/winrm-https-ansible/


错误

我使用 win_ping 模块测试了连接,并收到了以下输出:

**ansible windows -vvvv -i hosts -m win_ping**

NanoServer | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: OpenSSH_8.2p1 Ubuntu-4ubuntu0.1, OpenSSL 1.1.1f  31 Mar 2020
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
    debug1: /etc/ssh/ssh_config line 21: Applying options for 
    *debug1: auto-mux: Trying existing master
    debug1: Control socket \"/home/woliveira/.ansible/cp/6df2d837bc\" does not exist
    debug2: resolving \"nanoserver\" port 5986
    debug2: ssh_connect_direct
    debug1: Connecting to nanoserver [10.11.39.250] port 5986.
    debug2: fd 3 setting O_NONBLOCK
    debug1: fd 3 clearing O_NONBLOCK
    debug1: Connection established.
    debug3: timeout: 25000 ms remain after connect
    debug1: identity file /home/woliveira/.ssh/id_rsa type -1
    debug1: identity file /home/woliveira/.ssh/id_rsa-cert type -1
    debug1: identity file /home/woliveira/.ssh/id_dsa type -1
    debug1: identity file /home/woliveira/.ssh/id_dsa-cert type -1
    debug1: identity file /home/woliveira/.ssh/id_ecdsa type -1
    debug1: identity file /home/woliveira/.ssh/id_ecdsa-cert type -1
    debug1: identity file /home/woliveira/.ssh/id_ecdsa_sk type -1
    debug1: identity file /home/woliveira/.ssh/id_ecdsa_sk-cert type -1
    debug1: identity file /home/woliveira/.ssh/id_ed25519 type -1
    debug1: identity file /home/woliveira/.ssh/id_ed25519-cert type -1
    debug1: identity file /home/woliveira/.ssh/id_ed25519_sk type -1
    debug1: identity file /home/woliveira/.ssh/id_ed25519_sk-cert type -1
    debug1: identity file /home/woliveira/.ssh/id_xmss type -1
    debug1: identity file /home/woliveira/.ssh/id_xmss-cert type -1
    debug1: Local version string SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.1
    **Connection timed out during banner exchange",
    "unreachable": true**
}

接下来,我尝试增加 ansible 配置文件中的超时时间,我收到对等方重置的连接。

NanoServer | UNREACHABLE! => {
        "changed": false,
        "msg": "Failed to connect to the host via ssh: OpenSSH_8.2p1 Ubuntu-4ubuntu0.1, OpenSSL 1.1.1f  31 Mar 2020
        debug1: Reading configuration data /etc/ssh/ssh_config
        debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
        debug1: /etc/ssh/ssh_config line 21: Applying options for 
        *debug1: auto-mux: Trying existing master
        debug1: Control socket \"/home/woliveira/.ansible/cp/6df2d837bc\" does not exist
        debug2: resolving \"nanoserver\" port 5986
        debug2: ssh_connect_direct
        debug1: Connecting to nanoserver [10.11.39.250] port 5986.
        debug2: fd 3 setting O_NONBLOCK
        debug1: fd 3 clearing O_NONBLOCK
        debug1: Connection established.
        debug3: timeout: 3600000 ms remain after connect
        debug1: identity file /home/woliveira/.ssh/id_rsa type -1
        debug1: identity file /home/woliveira/.ssh/id_rsa-cert type -1
        debug1: identity file /home/woliveira/.ssh/id_dsa type -1
        debug1: identity file /home/woliveira/.ssh/id_dsa-cert type -1
        debug1: identity file /home/woliveira/.ssh/id_ecdsa type -1
        debug1: identity file /home/woliveira/.ssh/id_ecdsa-cert type -1
        debug1: identity file /home/woliveira/.ssh/id_ecdsa_sk type -1
        debug1: identity file /home/woliveira/.ssh/id_ecdsa_sk-cert type -1
        debug1: identity file /home/woliveira/.ssh/id_ed25519 type -1
        debug1: identity file /home/woliveira/.ssh/id_ed25519-cert type -1
        debug1: identity file /home/woliveira/.ssh/id_ed25519_sk type -1
        debug1: identity file /home/woliveira/.ssh/id_ed25519_sk-cert type -1
        debug1: identity file /home/woliveira/.ssh/id_xmss type -1
        debug1: identity file /home/woliveira/.ssh/id_xmss-cert type -1
        debug1: Local version string SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.1
        kex_exchange_identification: read: **Connection reset by peer",
        "unreachable": true**
    }

环境设置。

Ansible 2.9.6 安装在 Ubuntu 20.04.1 LTS虚拟机中

我的 Windows 服务器如下: 操作系统名称:Microsoft Windows Server 2016 标准评估操作系统版本:10.0.14393 N/A Build 14393

两个虚拟机都有静态 IP 并且不在域中。我遵循本教程: https ://vnuggets.com/2019/08/08/ansible-certificate-authentication-to-windows/

我创建了一个名为 ansibleoperator 的 Windows 本地用户,并将该用户添加到 Local Admi Group 中。这是我的 Ansible 主机文件:

[windows]
NanoServer

[windows:vars]
ansible_user=ansibleoperator
ansible_password=*********
ansble_connection=winrm
ansible_winrm_cert_pem=/home/woliveira/cert.pem
ansible_winrm_cert_key_pem=/home/woliveira/cert_key.pem
ansible_port=5986
ansible_winrm_scheme=https
ansible_winrm_server_cert_validation=ignore

Windows 防火墙已禁用 TrustedHosts 已为任何主机配置(值 =*)

我检查过的

如果另一个 Windows 主机能够使用 winrm 连接:PS C:> Test-WSMan -ComputerName "NanoServer" -UseSSL

wsmid           : http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsd
ProtocolVersion : http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd
ProductVendor   : Microsoft Corporation
ProductVersion  : OS: 0.0.0 SP: 0.0 Stack: 3.0

在 Linux 端,我可以使用 Netcat 使用以下命令测试 5986 端口中的连接:

 nc -z -w1 NanoServer 5986;echo $?

输出为 0(命令成功)

我已经尝试从其他 Windows 进行连接,但这次使用 pywinrm 脚本,因为它与 Ansible 使用的库相同。我运行这个脚本:

import winrm

cert_pem = 'C:/Users/woliveira.adm/Desktop/CertificadoAnsible/cert.pem'
cert_key_pem = 'C:/Users/woliveira.adm/Desktop/CertificadoAnsible/cert_key.pem'


session = winrm.Session('NanoServer:5986', auth=('ansibleoperator', '********'),
                        transport='certificate',
                        cert_pem=cert_pem, 
                        cert_key_pem=cert_key_pem,
                        server_cert_validation='ignore',
                        )
session.run_cmd('ipconfig')

并收到这个:

Traceback (most recent call last):

  File "<ipython-input-56-b902c730fb9c>", line 1, in <module>
    runfile('C:/Users/woliveira.adm/Desktop/testewinrm.py', wdir='C:/Users/woliveira.adm/Desktop')

  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 786, in runfile
    execfile(filename, namespace)

  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "C:/Users/woliveira.adm/Desktop/testewinrm.py", line 19, in <module>
    session.run_cmd('ipconfig')

  File "C:\ProgramData\Anaconda3\lib\site-packages\winrm\__init__.py", line 39, in run_cmd
    shell_id = self.protocol.open_shell()

  File "C:\ProgramData\Anaconda3\lib\site-packages\winrm\protocol.py", line 166, in open_shell
    res = self.send_message(xmltodict.unparse(req))

  File "C:\ProgramData\Anaconda3\lib\site-packages\winrm\protocol.py", line 243, in send_message
    resp = self.transport.send_message(message)

  File "C:\ProgramData\Anaconda3\lib\site-packages\winrm\transport.py", line 323, in send_message
    response = self._send_message_request(prepared_request, message)

  File "C:\ProgramData\Anaconda3\lib\site-packages\winrm\transport.py", line 328, in _send_message_request
    response = self.session.send(prepared_request, timeout=self.read_timeout_sec)

  File "C:\ProgramData\Anaconda3\lib\site-packages\requests\sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)

  File "C:\ProgramData\Anaconda3\lib\site-packages\requests\adapters.py", line 529, in send
    raise ReadTimeout(e, request=request)

ReadTimeout: HTTPConnectionPool(host='10.11.39.250', port=5986): Read timed out. (read timeout=30)

我不知道如何调试它。我可以检查什么?

对不起我的英语。如果有什么不清楚的地方,请告诉我。

networking ssl ansible windows-server-2016 winrm
  • 1 个回答
  • 4718 Views
Martin Hope
Usman
Asked: 2020-08-29 05:15:42 +0800 CST

如何从本地使用 powershell 连接到远程服务器。Enter-PSSession 不工作(不相关的 Exchange 服务)

  • -1

我正在尝试使用本地 powershell 会话连接到远程计算机。

为此,我尝试使用本地 powershell Enter-PSSession 或 New-PSSession 命令作为:

$session = New-PSSession -ConnectionUri 'http://testserverUri.dom/PowerShell'

但是我总是在异常之后得到。

New-PSSession : [testserveruri.dom] Connecting to remote server apdv0710.forest7.dom failed with the following
error message : The WinRM client sent a request to an HTTP server and got a response saying the requested HTTP URL was
not available. This is usually returned by a HTTP server that does not support the WS-Management protocol. For more
information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:12
+ $session = New-PSSession -ConnectionUri 'http://testserverUri.dom/ ...
+            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotin
   gTransportException
    + FullyQualifiedErrorId : URLNotAvailable,PSSessionOpenFailed

我还使用了其他变体:

    Enter-PSSession -Authentication Kerberos -ConnectionUri 'http://testserveruri.dom/PowerShell' -Cred $credential
    Enter-PSSession : Connecting to remote server apdv0710.forest7.dom failed with the following error message : The WinRM
    client sent a request to an HTTP server and got a response saying the requested HTTP URL was not available. This is
    usually returned by a HTTP server that does not support the WS-Management protocol. For more information, see the
    about_Remote_Troubleshooting Help topic.
    At line:1 char:12
    + $session = Enter-PSSession -Authentication Kerberos -ConnectionUri 'h ...
    +            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidArgument: (http://testserveruri.dom/PowerShell:Uri) [Enter-PSSession], PSRemot
       ingTransportException
        + FullyQualifiedErrorId : CreateRemoteRunspaceFailed

在大多数情况下,我得到了第一个例外。

当我使用 C# 打开运行空间并为 WSManConnectionInfo 对象提供远程服务器 powerSell url 时,也会发生同样的异常。

我已经对 winrm 命令进行了各种处理,但这并不能真正解决问题。如何摆脱这个问题?

powershell remoting winrm ps
  • 2 个回答
  • 1540 Views
Martin Hope
Jack
Asked: 2020-05-20 18:36:22 +0800 CST

访问被拒绝 WinRM 错误代码 5

  • 2

我们正在尝试在我们的环境中设置 Windows 事件转发 (WEF),但遇到了一些问题。我们设置了一个 GPO(如下所示)以启用将事件转发到本地收集服务器,并且我们配置了连接服务器。收集器机器显示为已正确订阅,但我们正在测试的另一台机器未连接到收集服务器。

在无法转发日志的源机器上,我们在Application and Services Logs -> Microsoft -> Windows -> Eventlog ForwardingPlugin下看到以下错误

The forwarder is having a problem communicating with subscription manager at address 
http://Collector.corp.company.com:5985/wsman/SubscriptionManager/WEC.  
Error code is 5 and Error Message is 
<f:WSManFault xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault" Code="5"
Machine="SourceMachine.corp.company.com"><f:Message>Access is denied. </f:Message></f:WSManFault>.

在收集器机器上,我们在Application and Services Logs -> Microsoft -> Windows -> Windows Remote Management -> Operational下看到以下错误

The authorization of the user failed with error 5

有关收集器服务器错误的更多详细信息:

Source: Windows Remote Managment
Event ID: 192
Level: Information       Task Category: User Authorization
User: Network Service    Keywords: Security,Server
OpCode: Informational    Computer: Collector.corp.company.com

正在申请的 GPO: 总局图像 1 总局图像 2 总局图像 3

windows group-policy windows-event-log winrm
  • 2 个回答
  • 9229 Views
Martin Hope
mivra
Asked: 2020-04-25 06:36:19 +0800 CST

Windows Admin Center 可以连接到远程服务器吗?

  • 3

我在想,通过一个 Windows Admin Center 安装,我将能够管理多个远程 Win 服务器。但是,添加服务器对话框似乎只能找到本地/LAN 服务器。这是可能的还是我需要在每台服务器上单独安装 WAC,因此每个服务器都有自己的地址?

windows sysadmin windows-admin-center winrm
  • 2 个回答
  • 1943 Views
Martin Hope
JukEboX
Asked: 2017-08-29 10:20:03 +0800 CST

什么是 WinRM 运行空间池?

  • 0

因此,我在从 Windows Server 2012 R2 服务器安装/删除功能和滚动时遇到问题。无论我安装了哪个服务、角色或功能,我都会遇到此错误,称为 WinRM Runspace pool invalid。现在我知道两台服务器可以通过服务器管理器相互通信,并且我知道它们正在使用 WinRM 和 WSMan,但我不明白它们是否可以相互通信,它们是如何获得运行空间池错误的。所以我想在我尝试过的所有修复之后更好地理解错误是尝试理解什么是“运行空间池”以及如何解决它?我无法从 Microsoft 那里找到有关它是什么的任何信息。谁能解释一下,也许它会如何影响我得到的错误?

winrm
  • 1 个回答
  • 1808 Views
Martin Hope
JukEboX
Asked: 2017-07-25 07:57:45 +0800 CST

WinRM 使用 Server 2012 r2 服务器管理器添加/删除功能时出现问题

  • 0

我正在尝试通过运行 Windows Server 2012 R2 的服务器管理器让 2 台服务器相互通信。

SERVER1 能够毫无问题地刷新所有服务器信息。我可以毫无问题地看到 SERVER1 & 2 的所有状态。SERVER2 说 RPC 服务器不可用并且找不到 SERVER 1。

当我从 SERVER1 执行以下命令winrm id -r:SERVER2时,我收到一个错误80338126,主要表示它无法使用 SERVER2。

winrm quickconfig 显示它已在 SERVER2 上设置和管理。使用适用于两台服务器的 GPO 允许它通过防火墙。

我已经尝试了这些修复: 修复 1 修复 2 修复 3 修复 4

我检查了以下内容:

  • 系统正在监听 127.0.0.1,网络 IP 地址,::1
  • WinRM 已配置并可远程管理
  • WinRM Enumerate 显示正在侦听端口 5296,并且允许通过防火墙
  • 远程外壳设置为未配置
  • 服务器已重启

还有什么我可以做的吗?WinRM 应该可以工作。这是一个生产服务器,被配置为运行多个东西。我无法重建它。

更新:我发现一个名为“HTTP Through TLS/SSL”的防火墙规则设置为“public”而不是 Private/Domain。我改变了那个。SERVER2 无法 WinRM 到 SERVER1,但使用服务器管理器我收到此错误:

配置刷新失败,出现以下错误。元数据未能从服务器检索到以下错误。WS-Management 服务无法处理该请求。在目录中找不到资源 URI。目录包含描述资源或逻辑端点的元数据。

winrm
  • 2 个回答
  • 9115 Views
Martin Hope
flow
Asked: 2017-01-18 02:27:53 +0800 CST

新用户拒绝 winrm 访问

  • 3

在 windows server 2012 上以管理员身份创建了新用户。在 powershell 中启动了 winrm( winrm quickconfig)。

但之后winrm configSDDL default的结果是WSMan fault: access denied。怎么了?

windows windows-server-2008 windows-command-prompt winrm
  • 1 个回答
  • 5539 Views
Martin Hope
EM0
Asked: 2016-10-27 09:23:03 +0800 CST

通过 WinRM 远程运行 PowerShell 脚本时获取 Windows 文件共享的本地路径

  • 0

我有一个 Windows 批处理脚本,它将 EXE 或批处理文件复制到远程文件共享并使用 PowerShell WinRM 在远程服务器上运行它。远程运行命令的行如下所示:

ECHO Invoke-Command -Authentication CredSSP -Credential %USERDOMAIN%\%USERNAME% -ComputerName %SERVER_NAME% -ScriptBlock { cd (gwmi Win32_Share -Filter "name='%SHARE_NAME%'").Path ; .\%MY_EXE_TO_RUN% } |PowerShell.exe -Command -

我需要将当前目录更改为要运行的 EXE/批处理文件所在的文件共享目录(它依赖于此)。它也必须是一个本地目录 - 如果我尝试CD \\%SERVER_NAME%\%SHARE_NAME%这适用于 EXE,但对于批处理文件失败,则 cmd.exe 不支持将 UNC 路径作为当前目录。但是,我也不想在脚本中硬编码共享的本地路径,所以我尝试在 WMI 中查找它。

这对管理员来说很好,但对于非管理员来说会失败,并出现访问被拒绝错误。这些非管理员用户可以 RDP 到服务器,打开 PowerShell 并在gwmi Win32_Share那里成功运行。因此,通过 WinRM 运行时,权限检查似乎有所不同!

我发现http://www.adilhindistan.com/2013/10/permissions-to-access-wmi-remotely.html但在许多服务器上执行起来似乎相当复杂。除此之外,我不需要远程 WMI 访问。也许还有另一种方法可以解决共享的本地路径?或者,或者,我可以以某种方式运行 WMI 查询并对其应用本地权限检查吗?毕竟,我已经是远程服务器上的代码,所以应该有一些方法可以做到这一点。

powershell wmi windows-server-2012-r2 winrm
  • 1 个回答
  • 976 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve