Skip to content
August 17, 2009 / dw

Powershell health check script

# to schedule task
#C:WINDOWSsystem32WindowsPowerShellv1.0powershell.exe -command c:scheduledtaskshealthstatus.ps1
#Don Wilwol
#
Set-ExecutionPolicy -unrestricted
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin
$tr = test-replicationhealth
$trText = $tr | ft | Out-String
$gsgc = Get-StorageGroupCopyStatus
$gsgcText = $gsgc | ft | Out-String
#$gel = get-EventLog application -newest 1500 | where {$_.entryType -match "Error"}
#$geltxt = $gel | ft | Out-string
$gcmbs = Get-ClusteredMailboxServerStatus
$gcmbstxt = $gcmbs | ft -Wrap | Out-string
$SmtpClient = new-object system.net.mail.smtpClient
$SmtpServer = "email.yourdomainname.org"
$SmtpClient.host =
$SmtpServer
$From = "yourname@yourdomainname.com"
$To = "sysadmins@yourdomainname.com"
$Title = " CCR Check"
$Body = $msg + "test-replicationhealth" + $trText + "Get-StorageGroupCopyStatus" + `
$gsgcText + "Get-ClusteredMailboxServerStatus" + $gcmbstxt
$SmtpClient.Send($from,$to,$title,$Body) 
 
#http://exchangeshare.wordpress.com/2008/12/08/how-to-schedule-powershell-script-for-an-exchange-task/
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: