任何人都明白为什么下面的简单 Powershell 脚本在 Windows XP 下运行良好但在 Windows 7 下运行良好?
Get-WmiObject -Class win32_logonsession | %{ get-wmiobject -Query "AssocClass = Win32_LoggedOnUser Role=Dependent 的 {Win32_logonSession.LogonID=$($_.LogonId)} 的关联者"}
在 Windows 7 下,它不会列出任何交互式帐户,只列出本地系统帐户的会话、网络服务等。但是在 XP 下,它会返回所有帐户的信息。
一直在寻找 MSDN 和谷歌,但还没有找到答案。