Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell 如何获取已登录到计算机的用户的帐户列表?_Powershell - Fatal编程技术网

Powershell 如何获取已登录到计算机的用户的帐户列表?

Powershell 如何获取已登录到计算机的用户的帐户列表?,powershell,Powershell,我正在寻找一种方法,找出哪些用户曾经使用PowerShell登录过本地windows 10计算机 利用 Get-WmiObject -Class Win32_UserAccount -Filter "LocalAccount='True'" 我得到了一个用户列表,但我认为这还不完整,因为主目录比列表上显示的要多。这将获得所有已登录到计算机的缓存帐户。请注意,有一些方法可以清除此项,因此可能有其他人已登录,但清除了跟踪。如果对lastusetime感兴趣,请确保以管理员身份运行 Get-Cim

我正在寻找一种方法,找出哪些用户曾经使用PowerShell登录过本地windows 10计算机

利用

Get-WmiObject -Class Win32_UserAccount -Filter  "LocalAccount='True'"

我得到了一个用户列表,但我认为这还不完整,因为主目录比列表上显示的要多。

这将获得所有已登录到计算机的缓存帐户。请注意,有一些方法可以清除此项,因此可能有其他人已登录,但清除了跟踪。如果对
lastusetime
感兴趣,请确保以管理员身份运行

Get-CimInstance win32_userprofile -verbose | Select localpath, lastusetime
(如果您不想显示操作,可以删除
-verbose
,当然也可以为您感兴趣的内容选择