Archive for October, 2009
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
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