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 / 问题 / 1031867
Accepted
Usman
Usman
Asked: 2020-08-29 05:15:42 +0800 CST2020-08-29 05:15:42 +0800 CST 2020-08-29 05:15:42 +0800 CST

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

  • 772

我正在尝试使用本地 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 2 个回答
  • 1540 Views

2 个回答

  • Voted
  1. Daniel
    2020-08-29T05:39:11+08:002020-08-29T05:39:11+08:00

    为什么不简单Enter-PSSession apdv0710.forest7.dom呢?

    您需要先Enable-PSRemoting在 apdv0710.forest7.dom 上运行。

    • 1
  2. Best Answer
    Usman
    2020-08-29T06:07:48+08:002020-08-29T06:07:48+08:00

    通过仅提供计算机名称、Kerberos 作为身份验证机制以及包含用户名和密码的凭据对象,这对我有用。

    New-PSSession -Authentication Kerberos -Computer 'apdv004s' -Cred $credential 
    

    相同的用法Enter-PSSession。

    • 0

相关问题

  • 资源锁和电源外壳

  • 脚本 - 如何断开远程桌面会话?

  • 如何限制向通讯组发送到外部地址?

  • Powershell对值与数组的作用不同?

  • Windows Powershell Vim 键绑定

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