首页 > 解决方案 > '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?

标签: powershell

解决方案


我希望您尝试在服务器而不是工作站上运行此命令。我试图从我的笔记本电脑上运行它并没有工作,但当我在服务器上运行它时总是工作。


推荐阅读