Archive for the ‘Exchange things’ Category

PostHeaderIcon EX2007 Queue monitoring

Here is the same Queue monitoring script, but then written for exchange 2007.

##
# Exchange queue monitoring for exchange 2007
# Written by Marcel Stangenberger
#
# Created on 27/10/2009
# Version 1.0
##

$queuecount = (get-queue | where {$_.MessageCount -gt “20″})
$queueview = (get-queue)
$messageview = (get-queue | where {$_.MessageCount -gt “20″} | get-message)
$redalert = “red ” + (get-date)
$greenalert = “green ” + (get-date)
$tmppath = “C:\Program Files (x86)\Quest Software\Big Brother\BBNT\tmp\queue”
$logpath = “C:\Program Files (x86)\Quest Software\Big Brother\BBNT\Logs\queue”

if ( test-path $tmppath )
{
remove-item $tmppath
}

if ( $queuecount -eq $null )
{
$greenalert | out-file -encoding ASCII $tmppath
$queueview | out-file -encoding ASCII $tmppath -append
$messageview | out-file -encoding ASCII $tmppath -append
}
Else
{
$redalert | out-file -encoding ASCII $tmppath
$queueview | out-file -encoding ASCII $tmppath -append
$messageview | out-file -encoding ASCII $tmppath -append
}

if ( test-path $logpath )
{
remove-item $logpath
}

move-item $tmppath $logpath

PostHeaderIcon EX2003 Queue monitoring with powershell

I’m a big fan of powershell. Now for a customer we’re hosting a windows 2003 server running exchange 2003. Since we use BigBrother as a monitoring tool we don’t have all the luxuries that more sophisticated monitoring tools have. So i’ve written a little script that does queue monitoring for you.

##
# Exchange queue monitoring for exchange 2003
# Written by Marcel Stangenberger
#
# Created on 27/10/2009
# Version 1.0
##

$queuecount = ((Get-WmiObject -class Exchange_SMTPQueue -Namespace ROOT\MicrosoftExchangev2 |select-object LinkName,MessageCount | where {$_.MessageCount -gt “9″}).count)
$queueview = (Get-WmiObject -class Exchange_SMTPQueue -Namespace ROOT\MicrosoftExchangev2 |select-object LinkName,MessageCount,Size)
$redalert = “red ” + (get-date)
$greenalert = “green ” + (get-date)
$tmppath = “C:\Program Files\Quest Software\Big Brother\BBNT\tmp\queue”
$logpath = “C:\Program Files\Quest Software\Big Brother\BBNT\Logs\queue”

if ( test-path $tmppath )
{
remove-item $tmppath
}

if ( $queuecount -eq $null )
{
$greenalert | out-file -encoding ASCII $tmppath
$queueview | out-file -encoding ASCII $tmppath -append
}
Else
{
$redalert | out-file -encoding ASCII $tmppath
$queueview | out-file -encoding ASCII $tmppath -append
}

if ( test-path $logpath )
{
remove-item $logpath
}

move-item $tmppath $logpath

PostHeaderIcon Cleaning up your mailserver

ever had the issue that you need to clean up the mailboxes but keep the accounts alive because of forwards or stuff like that. In exchange 2003 it was a hell of a job, logging in to the users mailbox, clean everything up and leaving it at that. But now, in exchange 2007 you have powershell, which makes this a whole lot easier. Just move the group of users to an organizational unit and run :

get-mailbox -OrganizationalUnit “<unitname>” | export-mailbox -PSTFolderPath <path> -DeleteContent

This will give you an amount of PST files with the original content of the mailboxes and then clean them out without deleting the mailbox itself.

Search
Archives

You are currently browsing the archives for the Exchange things category.