Skip to main content

Compare-ADGroupMembers

Description​

Returns information about membership changes to a group based on previous runs of the script.

Requirements​

Should be run on an Active Directory Domain Controller.

Usage​

  1. If the script has not been run previously for the target group, the script will create the pertinent registry key and value, and then exit.
  2. Previous runs of the script are then compared with the current run.
  3. If changes are detected, the changes will be logged and added to the return object.
  4. Update the list of users in the registry with the live user list.
  5. Return the object.
.\Compare-ADGroupMembers.ps1 -ADGroupName "Domain Admins"

Compares the users found in the last run of Compare-ADGroupMembers.ps1 with the current list of members of the specified group and returns the differences between the two.

Parameters​

ParameterAliasRequiredDefaultTypeDescription
ADGroupNameTrueStringSpecifies the name of the group to compare the membership of.

Output​

Location of output for log, result, and error files.

  • System.Object
  • .\Compare-ADGroupMembers-log.txt
  • .\Compare-ADGroupMembers-data.txt
  • .\Compare-ADGroupMembers-error.txt

Changelog​

2025-04-10​

  • Initial version of the document