This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
exchange:reporting_project:database_queries [2010/02/14 06:01] ben |
exchange:reporting_project:database_queries [2010/02/18 15:50] (current) ben |
||
---|---|---|---|
Line 92: | Line 92: | ||
select displayName,alpha_samid,size,disabled,bes,OU,mdb,lastExchangeLogon from exchange_info where NOT ((disabled='1' AND OU LIKE '%Medical Center%' AND mdb LIKE '%MS6%' AND bes='0') OR displayName NOT LIKE '%System%' AND server LIKE '%exchange3%' AND mdb LIKE '%MS6%' and bes='0' AND disabled='0') AND mdb LIKE '%MS6%' ORDER BY disabled,size; | select displayName,alpha_samid,size,disabled,bes,OU,mdb,lastExchangeLogon from exchange_info where NOT ((disabled='1' AND OU LIKE '%Medical Center%' AND mdb LIKE '%MS6%' AND bes='0') OR displayName NOT LIKE '%System%' AND server LIKE '%exchange3%' AND mdb LIKE '%MS6%' and bes='0' AND disabled='0') AND mdb LIKE '%MS6%' ORDER BY disabled,size; | ||
</code> | </code> | ||
- | |||
==== Export to CSV file ==== | ==== Export to CSV file ==== | ||
<code> | <code> | ||
select displayName,size,ou from exchange_info INTO OUTFILE '/Users/ben/tmp/test.txt' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' ; | select displayName,size,ou from exchange_info INTO OUTFILE '/Users/ben/tmp/test.txt' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' ; | ||
+ | </code> | ||
+ | ==== Report for a particular OU into a CSV file ==== | ||
+ | <code> | ||
+ | select displayName as "Mailbox Name",alpha_samid as "ID",disabled as Disabled,bes as "Blackberry User",size "Mailbox Size (KB)",lastLogon as "Last AD Logon", lastExchangeLogon as "Last Mailbox Logon",OU from exchange_info where OU LIKE '%Columbia%College%' AND displayName NOT LIKE '%System%' ORDER BY disabled DESC,size INTO OUTFILE '/Users/ben/tmp/test.txt' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n'; | ||
</code> | </code> |