Logon Statistic Shell
this post has been moved to
http://www.exchange-genie.com/2008/09/logon-statistic-shell/
This blog is dedicated to posting information about Microsoft Exchange Server
this post has been moved to
http://www.exchange-genie.com/2008/09/logon-statistic-shell/
Posted by
Exchange_Genie
at
10:24 AM
Labels: EMS, exchange 2007, exchange 2007 Service Pack 1, exchange management shell, Powershell
9 comments:
Is there a reason script is provided as a screen shot? Posting images makes sure nobody will be able to try this out easily :)
my apoloiges, I was doing it from work and the blogger always drops some of the character unless I edit the html so I thought it was easier to add a jpg. There is no option to add a file to download or I would have done it that way.
I will post the code but check the syntax because the system removes some characters
Hi Genie
I would skip the get-mailbox call and start directly with Get-MailboxStatistics :
$data = Get-MailboxStatistics | where { ($_.lastLogonTime -gt $date) -and ($_.objectClass -notmatch 'ExOleDbSystemMailbox')}
-Shay
First good call to add the skip system mailboxes.....
you can however Get-MailboxStatistics will only run agaist the local server. so if only have 1 then you are ok, however for large multi server environmnets adding the get-mailbox will get all the mailboxes.
http://technet.microsoft.com/en-us/library/bb124612.aspx
You're right :-), it won't work for multi server environmnets, but you can work it out. I found two ways:
1. Put the servers name in a csv file, import it and pipe it to Get-MailboxStatistics, A sample file will look like:
## c:\exServers.csv ##
server
ex1
ex2
PS > import-csv c:\exServers.csv | Get-MailboxStatistics
2. Cast the servers name to a ServerIdParameter and then pipe to Get-MailboxStatistics:
PS > [Microsoft.Exchange.Configuration.Tasks.ServerIdParameter[]]("ex1","ex2") | Get-MailboxStatistics
-Shay
lots of ways to do it, whatever works for you... you can have it read in input for the servers etc...
I like to set all mbx's to the variable and then I can call it again to get other data with out the additioanl query overhead..
i.e I have a script that checks how many users use active sync or iphone etc.... I could combine them but only do 1 query.
You can always screenshot the jpg using OneNote and then capture text out of said jpg. :)
It seems I took the long path for no reason, to get mailbox statistics in large multi server environmnets one can simply do:
PS > Get-MailboxServer | Get-MailboxStatistic
-Shay
gotta love the piping :)
Post a Comment