Create Shadow Groups (Dynamic Groups) in Active Directory

Basically what you have to do is to write a multi function PowerSell script. We will need more than a couple of Pipes in this script. In order to understand the code, let's translate it to human language:

Find Group1 in AD | Find Disabled members in the Member List | Remove them

Now if you want to have a fully automated one, you need to schedule this script to run hourly in your domain controller. Here is the script:

Get-ADGroupMemberGroupTest|%{Get-ADUser-Identity $_.distinguishedName

-PropertiesEnabled,samaccountname |?{$_.Enabled-eq $false}|?

{Remove-ADGroupMember-IdentityGroupTest-Members

$_.samaccountname -Confirm:$false}}

Have fun automating..