用户和本地组使用 Powershell 报告? [英] Users and Local Groups Report using Powershell?
本文介绍了用户和本地组使用 Powershell 报告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有一种简单的方法使用 powershell 来显示机器上所有活动的本地 Windows 组以及属于这些组的用户?这个问题的第二部分是它是否可以扩展为一次查看不止一台机器.
Is there a simple way using powershell to show all Local Windows Groups that are active on a machine and the users that are part of those groups? A second part of this question would be if it can be extended to look at more than one machine at a time.
推荐答案
实际上您可以使用 ADSI 类型快捷方式和 WinNT 名称.以下是从您自己的机器上列出群组和成员的示例:
In fact you can with the ADSI type shortcut and the WinNT moniker. Here's an example to list groups and members from your own machine:
$server="."
$computer = [ADSI]"WinNT://$server,computer"
$computer.psbase.children | where { $_.psbase.schemaClassName -eq 'group' } | foreach {
write-host $_.name
write-host "------"
$group =[ADSI]$_.psbase.Path
$group.psbase.Invoke("Members") | foreach {$_.GetType().InvokeMember("Name", 'GetProperty', $null, $_, $null)}
write-host
}
这篇关于用户和本地组使用 Powershell 报告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文