To get computer group membership with PowerShell, follow these steps:
- Open the Powershell ISE on your domain controller.
- Run the following Powershell script, supplying the CSV file report output path and the computer name:
$Path= "C:\Temp\ComputerGroups.csv"
$Name= "EXCHANGE"
Get-ADComputer -Filter {Name -like $Name} | ForEach-Object {
$computer= $_
Get-ADPrincipalGroupMembership -Identity $_|
Select-Object @{Name = 'Computer Name'; Expression =
{$computer.SamAccountName}},@{Name = 'GroupName'; Expression =
{$_.SamAccountName}},@{Name = 'Distinguished Name'; Expression =
{$_.distinguishedname}}, @{Name = 'Member'; Expression = {$computer.DNSHostName}}
}| Export-Csv -Path $Path -NoTypeInformation
Note that you can get a summary of all domain computer accounts by specifying $Name = "*"; however, this report will take significant time to generate.
- Review .csv report:
To get computer group membership with Netwrix Auditor, follow these steps:
- Run Netwrix Auditor
- Navigate to “Reports” -> Choose “Predefined” -> Expand the “Active Directory” section -> Go-to “Active Directory – State-in-Time” -> Select “Users and Computers – Effective Group Membership” -> Click “View”.
- In the “Account Name” field, specify the computer you want to report on.
- In “Membership type” field, specify “Directly”.
- Review your report. Note that in the sample report below, Netwrix Auditor has translated the cryptic string “$H31000-K5769ISACFFV” from the native report at the left into the readable group name, “Exchange Install Domain Servers”.