zoukankan      html  css  js  c++  java
  • 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
    
  • 相关阅读:
    linux使用windows中编辑的文件,格式问题
    模拟退火算法c++
    progress第三方框架和二维码第三方框架的选择
    iOS 初始化项目内容
    github上使用SSH和gitignore
    wordpress 如何设置自定义的首页
    wordpress 删除底部"自豪地采用 WordPress"
    masonry注意事项
    iOS修改工程名
    iOS版本更新在APP中直接访问AppStore
  • 原文地址:https://www.cnblogs.com/JinweiChang/p/14718742.html
Copyright © 2011-2022 走看看