Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/14.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
Windows 如何获取所有远程计算机';通过Powershell的用户名?_Windows_Powershell - Fatal编程技术网

Windows 如何获取所有远程计算机';通过Powershell的用户名?

Windows 如何获取所有远程计算机';通过Powershell的用户名?,windows,powershell,Windows,Powershell,是否有任何方法可以通过Powershell获取远程计算机上所有本地用户帐户的列表?您可以通过WMI查询获取此信息 function Get-LocalUser ($Computername = $env:COMPUTERNAME) { Get-WmiObject -Query "Select * from Win32_UserAccount Where LocalAccount = 'True'" -ComputerName $ComputerName | Select-Obje

是否有任何方法可以通过Powershell获取远程计算机上所有本地用户帐户的列表?

您可以通过WMI查询获取此信息

function Get-LocalUser ($Computername = $env:COMPUTERNAME) {
    Get-WmiObject -Query "Select * from Win32_UserAccount Where LocalAccount = 'True'" -ComputerName $ComputerName |
    Select-Object -ExpandProperty Name 
}

Get-LocalUser -ComputerName "TestPC1"

您是指本地用户帐户还是当前登录的用户?是的,指存储在SAM中的所有用户。