Powershell Support Hostmonitor 8.06

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Post Reply
braskoer
Posts: 7
Joined: Tue Jun 06, 2006 3:59 am
Contact:

Powershell Support Hostmonitor 8.06

Post by braskoer »

Hello,

I would like to use shell Script to run powershell scripts on Exchange 2007/2010 to check the database size, it this possible with Hostmonitor 8.06?

Thanks for your reply

With Regards,

Jan-Rinze
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

HostMonitor 8.06? No.
This option was implemented in version 8.14
http://www.ks-soft.net/hostmon.eng/news.htm#v814

How To Check Exchange Database Size with PowerShell
http://www.mikepfeiffer.net/2010/05/qui ... owershell/

Regards
Alex
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

BTW
Script for Exchange 2007 may look like

Code: Select all

$statusOk          = "ScriptRes:Ok:"
$statusBad         = "ScriptRes:Bad:"
$statusUnknown     = "scriptRes:Unknown:"

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin

$id=$args[1]
if ($args.count -lt 1) {
echo $statusUnknown" parameters required: <MailBoxThreshold in MB> [<hostname\database name>]"
exit
}
if ($args.count -eq 1) {$id="*"}

$mboxes = Get-MailboxDatabase -identity $id | foreach-object {add-member -inputobject $_ -membertype noteproperty -name mailboxdbsize -value ([math]::Round(([int64](get-wmiobject cim_datafile -computername $_.server -filter ('name=''' + $_.edbfilepath.pathname.replace("\","\\") + '''')).filesize / 1MB),2)) -passthru}
$mbtotal=0
foreach ($mbox in $mboxes) {
$mbtotal=$mbtotal+$mbox.mailboxdbsize
}

$d1 = $args[0] -as [decimal]
$d2 = $mbtotal -as [decimal]

if ($d2 -gt $d1)
{
  echo $statusOk$d2" MB "$id
} 
else 
{
  echo $statusBad$d2" MB "$id
}
There are 2 parameters:
1) MailBoxThreshold (in MB)
2) hostname\database_name
Start command: powershell.exe %Script% %Params%

Regards
Alex
Post Reply