I wanted to know when new members are added to the domain admins group, or any existing member deleted from the domain admin group.

Is it possible to put in something like?

if return value user1, user2, user3 value = 1 Matches OK
if anything, else value = 0 Error

Then we can use a lookup file to go, if 1 the check is green, if 0 the check is red. The goal is to set it, so we are checking the actual account names in the domain admin group not just the number of accounts. If its possible, Can you please send me some PowerShell script examples.


Article Comments

Hello there,

As per your scenario, you need to update the counter manually every time when you add/delete a contact. It would rather to have the parameters groupName and minCount to check against. But, it's come down to Get-ADGroupMember -Identity "Administrators").Count.

Besides that, you also need to RSAT for this though: https://docs.microsoft.com/en-us/troubleshoot/windows-server/system-management-components/remote-server-administration-tools

I am afraid that, I do not have any PS script example for this.


Jul, 2021 - Permalink