Share via


PowerShell Script get Active Directory objects that are Expired and delete them

 

 import-module activedirectory
$ADO = Search-ADAccount -AccountExpired
foreach($object in $ADO)
{
Remove-ADObject -Identity $object.DistinguishedName -Confirm:$false
}