powershell - 'quser' 未被识别为 cmdlet、函数、脚本文件或可运行程序的名称
问题描述
在 powershell 脚本中使用 quser 获取有关远程桌面 sesison 主机上的用户会话的信息时,发生错误,显示The term 'quser' is not recognized as the name of a cmdlet, function, script file, or operable program
. 代码是这样的,
$hostObject = [System.Net.Dns]::GetHostByAddress($ip) | Select-Object HostName
$hostName = $hostObject.HostName
$hostInformation = quser /server:$hostName
如何让powershell识别quser?
解决方案
我希望您尝试在服务器而不是工作站上运行此命令。我试图从我的笔记本电脑上运行它并没有工作,但当我在服务器上运行它时总是工作。
推荐阅读
- c# - 解释 DependencyObject GetValue 方法
- python - Django Eclipse:如何在 Eclipse 中设置设置模块(尝试使用 django shell)?
- c++ - 对于可重定位的多平台安装,理想的 cmake 安装目录结构是什么?
- ios - 谁在为 UITableView 调用 reloadData 方法
- javascript - 如何根据当前日期从数组中找到最接近的日期值?
- javascript - 如何读取本地数据库文件?
- javascript - 阿贾克斯回来的时间太长了
- android - Facebook SDK 中的 LoginButton 为空
- apache-spark - 为什么我的 spark 应用程序太慢了?
- javascript - Gulp:'function()'不可分配给参数