powershell - 获取所有用户的所有 PSSession 列表

标签 powershell

我正在尝试使用远程 PSSession 连接到服务器,但收到以下错误:

The WS-Management service cannot process the request. The maximum number of concurrent shells allowed for this plugin has been exceeded. Retry the request later or raise the Maximum Shells per Plugin quota. For more information, see the about_Remote_Troubleshooting Help topic.

我知道我可以增加每个用户的 shell 数量,但我想确定此错误的原因以在将来缓解它。当我在远程计算机上运行 Get-PSSession -ComputerName "localhost"时,不会返回任何输出(这意味着我的用户没有打开任何 session )。有没有办法让我获取远程计算机上所有用户的所有 session ?

最佳答案

查看 Get-WSManInstance cmdlet,例如:

Get-WSManInstance -ComputerName $ComputerName -ResourceURI Shell -Enumerate

这是一篇关于我如何使用 cmdlet 并将其作为函数的一部分来对多台计算机运行相同命令的文章:http://tommymaynard.com/quick-learn-determine-if-theres-a-current-powershell-remoting-session-2016/ .

关于powershell - 获取所有用户的所有 PSSession 列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43008114/

相关文章:

powershell - 使用 Powershell 远程停止服务,无需 WMI 或远程处理

Azure - 从 EA 门户获取订阅列表及其状态

email - Get-AdUser 其中邮件不为空

azure - 从 Azure DevOps Pipeline 加载 Az.Kusto 2.0.0 PowerShell 模块时出现问题

windows - 如何在Surface RT上卸载暂存的应用程序包?

arrays - Powershell:选择 DataGridView 行

powershell - 在 PowerShell 中,有没有一种方法可以检查并打印操作 block 中断点命中的函数名称?

web-services - 使用 Powershell 对 Web 服务方法进行压力测试

powershell - 如何向自定义对象添加更多属性值

windows - 如何使用 PowerShell 2.0 递归删除整个目录?