• Powershell Session


    服务器上WinRM服务默认是开启的,

    查看服务是否开启,服务监听5985

    Get-Service winrm*
    

    如果没有开启,使用一下指令开启。

    Enable-PSRemoting -Force
    

    在用户端连接服务器,

    -Credential 可以使用域账号或本地的administrator,其他本地账号要添加到Remote Management Users组里才能连接。

    New-PSSession -ComputerName 主机名或IP   -Credential "domainuser"
    

    报错

    连接到远程服务器失败,错误消息如下: WinRM 客户端无法处理该请求。如果身份验证方案与 Kerberos 不同,或者
    客户端计算机未加入到域中, 则必须使用 HTTPS 传输或者必须将目标计算机添加到 TrustedHosts 配置设置。 使用 winrm.cmd 配置
    TrustedHosts。请注意,TrustedHosts 列表中的计算机可能未经过身份验证。 通过运行以下命令可获得有关此内容的更多信息: winrm
    help config。 有关详细信息,请参阅 about_Remote_Troubleshooting 帮助主题。
    + CategoryInfo          : OpenError: (:) [], PSRemotingTransportException
    + FullyQualifiedErrorId : PSSessionStateBroken
    

    先启动客户端的winrm,然后将服务器IP添加到客户端的信任列表,重新建立会话即可。

     Start-Service winrm
     Set-Item wsman:localhostclient	rustedhosts *
    

    查看本地建立的会话

    Get-PSSession
    

    进入会话,根据会话ID

    Enter-PSSession 3
    
  • 相关阅读:
    logback使用
    数据库阿里连接池 配置
    expect.js
    shim和polyfill有什么区别
    console.js还有浏览器不支持?
    vue项目如何实现剪切板功能--vue-clipboard2
    跟我一起使用webpack给一个开源项目添加一个运行入口
    Axure之添加点击页面
    Axure之母版窗口
    【react】react-reading-track
  • 原文地址:https://www.cnblogs.com/JinweiChang/p/14718742.html
Copyright © 2020-2023  润新知