Disable inactive AD accounts
Search-ADAccount -UsersOnly -AccountInactive -SearchBase "OU-disginguishedName" -TimeSpan "30" | Disable-ADAccount
Create a scheduled task to run the powershell script...
<Exec>
<Command>powershell.exe</Command>
<Arguments>-ExecutionPolicy Bypass -File "path-to-ps1-file"</Arguments>
</Exec>