Zantaz EAS Index Maintenance SQL query
If you don't use Zantaz EAS, hit the back button now... this is going to get boring quickly !
When using Zantaz EAS (Exchange Archive System) you have to create an index and eventually split it off when the index fills up. I split the Index membership from a DL maintained automagically by Imanami SmartDL to contain all active Exchange users. Since DL membership is dynamic over time (even without SmartDL), when you split the Index by DL you will invariably leave active users on that index.
This isn't a major problem, but you will need to continue updating your split indexes, you will see a nightly indexed count and the index will continue to grow a little. One way to reduce this problem is to find any users left on a split (retired) index and remove them manually. The following SQL query will help you find active users. Change the usi.search_index_id = x field to the index ID you've split and this will spit out the remaining active users.
select usi.userid, usrs.username
from user_search_index usi, users usrs
where
usi.search_index_id = 2
and usi.copynum = 1
AND usi.userid = usrs.userid
Shoutout to my buddy Ray Mays and EAS Support for this one.

Batch Script - Dump workstations from AD and check a file version »
Search