The following code snippet which I ran through PowerShell ISE (learn how to get it on Windows Server) will remove all disabled users from a particular group. Useful for the end of year / start of year clean up in a school environment.
You will need the ActiveRoles Management Shell for Active Directory, available by clicking here which were made by Quest Software, now DELL.
Add-PSSnapin Quest.ActiveRoles.ADManagement Get-QADGroup -SearchRoot "" | Foreach-Object { $group = $_ Get-QADGroupMember -Identity $group -Disabled -Type User | Foreach-Object{ Write-Host "Removing '$($_.Name)' from group '$group'" -Foreground Green Remove-QADGroupMember -Identity $group -Member $_ } }
Swap out with a distinguished name of the group you want to remove disabled users from. Once you execute it, it will run through the group and remove any user objects that are disabled.