PowerShell - List local users and groups
When you have a bunch of servers to manage and those servers are joined to an Active Directory Domain, it is really easy to query information from a single location, but when you are not using AD things get a little more complicated. It is a typical request to get the user list from all your users and the groups they belong to. If you are using AD, try installing the Power Shell Active Directory Module ( See 4Sysops article ). But if all your servers are not joined to a domain you will need to query the local users and groups so the Active Directory module is useless. Luckily, we can use the " Active Directory Service Interfaces " a.k.a [ADSI] . The script to query the users and groups and export a list ready to imported into a spreadsheet is really simple: $computerName = $env:COMPUTERNAME.Trim("`t|`n|`r") $computer = [ADSI]"WinNT://$computerName" $computer.psbase.children | where { $_.psbase.schemaClassName -eq 'group' } | foreach { $g...