<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Auto Email Exchange 2007 StorageGroupCopyStatus</title>
	<atom:link href="http://mattlog.net/2009/03/12/auto-email-exchange-2007-storagegroupcopystatus/feed/" rel="self" type="application/rss+xml" />
	<link>http://mattlog.net/2009/03/12/auto-email-exchange-2007-storagegroupcopystatus/</link>
	<description>Matts Admin Tips</description>
	<lastBuildDate>Thu, 02 Sep 2010 11:51:40 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Matt Shadbolt</title>
		<link>http://mattlog.net/2009/03/12/auto-email-exchange-2007-storagegroupcopystatus/comment-page-1/#comment-1701</link>
		<dc:creator>Matt Shadbolt</dc:creator>
		<pubDate>Tue, 10 Nov 2009 22:51:17 +0000</pubDate>
		<guid isPermaLink="false">http://mattlog.net/?p=124#comment-1701</guid>
		<description>Edit (seems the comment box doesn&#039;t like html...)
-------------------------------------------------
Hi Robban,
To convert the text color to something other than red you need to use the -body switch for the ConvertTo-Html. To change all the text red use:

ConvertToHtml -body &quot;&lt;font color=red&gt;&quot;

If you only want the colour to change if the status is healthy you need to add an if statement. It shouldn&#039;t be too hard for you to work out yourself, but here is a quick example of something simular. This script will output all processes and if the $colorred variable is set to &quot;yes&quot; will convert the HTML output to red:

$colorred = &quot;yes&quot;
If ($colorred -match &quot;yes&quot;)
{
Get-Process &#124; 
ConvertTo-Html name,path,fileversion -title &quot;Process Information&quot; -body &quot;&lt;font color=red&gt;&quot;&#124; 
Set-Content C:\pscripts\test.htm
}
else 
{
Get-Process &#124; 
ConvertTo-Html name,path,fileversion -title &quot;Process Information&quot;&#124; 
Set-Content C:\pscripts\test.htm
}</description>
		<content:encoded><![CDATA[<p>Edit (seems the comment box doesn&#8217;t like html&#8230;)<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
Hi Robban,<br />
To convert the text color to something other than red you need to use the -body switch for the ConvertTo-Html. To change all the text red use:</p>
<p>ConvertToHtml -body &quot;&lt;font color=red&gt;&quot;</p>
<p>If you only want the colour to change if the status is healthy you need to add an if statement. It shouldn&#8217;t be too hard for you to work out yourself, but here is a quick example of something simular. This script will output all processes and if the $colorred variable is set to &#8220;yes&#8221; will convert the HTML output to red:</p>
<p>$colorred = &quot;yes&quot;<br />
If ($colorred -match &quot;yes&quot;)<br />
{<br />
Get-Process |<br />
ConvertTo-Html name,path,fileversion -title &quot;Process Information&quot; -body &quot;&lt;font color=red&gt;&quot;|<br />
Set-Content C:\pscripts\test.htm<br />
}<br />
else<br />
{<br />
Get-Process |<br />
ConvertTo-Html name,path,fileversion -title &quot;Process Information&quot;|<br />
Set-Content C:\pscripts\test.htm<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robban</title>
		<link>http://mattlog.net/2009/03/12/auto-email-exchange-2007-storagegroupcopystatus/comment-page-1/#comment-1694</link>
		<dc:creator>Robban</dc:creator>
		<pubDate>Tue, 10 Nov 2009 12:18:28 +0000</pubDate>
		<guid isPermaLink="false">http://mattlog.net/?p=124#comment-1694</guid>
		<description>Hi and thanks for this!! but Im a newbie so could you write the code for this comment:
&quot;Hi Jonny,
Yeah you sould easily be able to consolidate the output into one email.&quot;

And is there anyway to format the output HTML email?
You know if the status is healthy the text is green or something like that :)

Best regards
Robban</description>
		<content:encoded><![CDATA[<p>Hi and thanks for this!! but Im a newbie so could you write the code for this comment:<br />
&#8220;Hi Jonny,<br />
Yeah you sould easily be able to consolidate the output into one email.&#8221;</p>
<p>And is there anyway to format the output HTML email?<br />
You know if the status is healthy the text is green or something like that <img src='http://mattlog.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Best regards<br />
Robban</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonny Barker</title>
		<link>http://mattlog.net/2009/03/12/auto-email-exchange-2007-storagegroupcopystatus/comment-page-1/#comment-1599</link>
		<dc:creator>Jonny Barker</dc:creator>
		<pubDate>Thu, 22 Oct 2009 14:23:00 +0000</pubDate>
		<guid isPermaLink="false">http://mattlog.net/?p=124#comment-1599</guid>
		<description>Hi again Matt, Just thought I&#039;d let you know that I got my script working just the way I want it. It basically now runs the command across 3 clusters, formats the output into a readable format, dumps it to a txt file which is then attached to an email and sent. Thanks alot for you help:

$logFilePath = new-item -type file -name &quot;$(get-date -uformat &#039;%Y%m%d%H%M%S&#039;)-filename.txt&quot;

#Set Variables
Get-StorageGroupCopyStatus -Server servername -StandbyMachine servername &#124; Format-Table -AutoSize &#124; out-file $logfilepath
Get-StorageGroupCopyStatus -Server servername -StandbyMachine servername &#124; Format-Table -AutoSize &#124; out-file $logfilepath -append
Get-StorageGroupCopyStatus -Server servername -StandbyMachine servername &#124; Format-Table -AutoSize &#124; out-file $logfilepath -append

#Email function
function sendmail($attachment)
{
    $SmtpClient = New-Object system.net.mail.smtpClient 
    $MailMessage = New-Object system.net.mail.mailmessage 
    $Attachment = New-Object System.Net.Mail.Attachment($logfilepath)
    $SmtpClient.Host = &quot;mailserver&quot; 
    $mailmessage.from = &quot;senders address&quot; 
    $mailmessage.To.add(&quot;recipients address&quot;) 
    $mailmessage.Subject = “Storage Group Copy Status report” 
    $MailMessage.IsBodyHtml = $false
    $mailmessage.Body = $body
    $MailMessage.Attachments.Add($Attachment)
    $smtpclient.Send($mailmessage) 
}

sendmail $AllServers

Jonny Barker</description>
		<content:encoded><![CDATA[<p>Hi again Matt, Just thought I&#8217;d let you know that I got my script working just the way I want it. It basically now runs the command across 3 clusters, formats the output into a readable format, dumps it to a txt file which is then attached to an email and sent. Thanks alot for you help:</p>
<p>$logFilePath = new-item -type file -name &#8220;$(get-date -uformat &#8216;%Y%m%d%H%M%S&#8217;)-filename.txt&#8221;</p>
<p>#Set Variables<br />
Get-StorageGroupCopyStatus -Server servername -StandbyMachine servername | Format-Table -AutoSize | out-file $logfilepath<br />
Get-StorageGroupCopyStatus -Server servername -StandbyMachine servername | Format-Table -AutoSize | out-file $logfilepath -append<br />
Get-StorageGroupCopyStatus -Server servername -StandbyMachine servername | Format-Table -AutoSize | out-file $logfilepath -append</p>
<p>#Email function<br />
function sendmail($attachment)<br />
{<br />
    $SmtpClient = New-Object system.net.mail.smtpClient<br />
    $MailMessage = New-Object system.net.mail.mailmessage<br />
    $Attachment = New-Object System.Net.Mail.Attachment($logfilepath)<br />
    $SmtpClient.Host = &#8220;mailserver&#8221;<br />
    $mailmessage.from = &#8220;senders address&#8221;<br />
    $mailmessage.To.add(&#8220;recipients address&#8221;)<br />
    $mailmessage.Subject = “Storage Group Copy Status report”<br />
    $MailMessage.IsBodyHtml = $false<br />
    $mailmessage.Body = $body<br />
    $MailMessage.Attachments.Add($Attachment)<br />
    $smtpclient.Send($mailmessage)<br />
}</p>
<p>sendmail $AllServers</p>
<p>Jonny Barker</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonny Barker</title>
		<link>http://mattlog.net/2009/03/12/auto-email-exchange-2007-storagegroupcopystatus/comment-page-1/#comment-1518</link>
		<dc:creator>Jonny Barker</dc:creator>
		<pubDate>Fri, 16 Oct 2009 11:14:40 +0000</pubDate>
		<guid isPermaLink="false">http://mattlog.net/?p=124#comment-1518</guid>
		<description>Awesome thanks. I&#039;ll give that a try.

Jonny</description>
		<content:encoded><![CDATA[<p>Awesome thanks. I&#8217;ll give that a try.</p>
<p>Jonny</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Shadbolt</title>
		<link>http://mattlog.net/2009/03/12/auto-email-exchange-2007-storagegroupcopystatus/comment-page-1/#comment-1493</link>
		<dc:creator>Matt Shadbolt</dc:creator>
		<pubDate>Wed, 14 Oct 2009 21:53:40 +0000</pubDate>
		<guid isPermaLink="false">http://mattlog.net/?p=124#comment-1493</guid>
		<description>Hi Jonny,

Yeah you sould easily be able to consolidate the output into one email.
What you want to do is break out the get-storagegroupcopystatus into three variables.
ie, $NodeOneStatus = Get-StorageGroupCopyStatus NODE1..
    $NodeTwoStatus = Get-StorageGroupCopyStatus NODE2..

Then pass the $NodeOneStatus and $NodeTwoStatus into the $MessageBody variable and the script will send all of the output from your $NodeOne/TwoStatus variables.

Cheers,
Matt.</description>
		<content:encoded><![CDATA[<p>Hi Jonny,</p>
<p>Yeah you sould easily be able to consolidate the output into one email.<br />
What you want to do is break out the get-storagegroupcopystatus into three variables.<br />
ie, $NodeOneStatus = Get-StorageGroupCopyStatus NODE1..<br />
    $NodeTwoStatus = Get-StorageGroupCopyStatus NODE2..</p>
<p>Then pass the $NodeOneStatus and $NodeTwoStatus into the $MessageBody variable and the script will send all of the output from your $NodeOne/TwoStatus variables.</p>
<p>Cheers,<br />
Matt.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonny Barker</title>
		<link>http://mattlog.net/2009/03/12/auto-email-exchange-2007-storagegroupcopystatus/comment-page-1/#comment-1485</link>
		<dc:creator>Jonny Barker</dc:creator>
		<pubDate>Wed, 14 Oct 2009 10:58:35 +0000</pubDate>
		<guid isPermaLink="false">http://mattlog.net/?p=124#comment-1485</guid>
		<description>Hi Matt,
This script is just what I was looking for. My only problem is that I have a 3 node cluster so I need to run this as is 3 times, i.e. 3 sets of Get-StorageGroupCopyStatus -Server PRIMARYSERVER -StandbyMachine SECONDARYSERVER.
Rather than schedule 3 separate powershells would there be an easy way to include all 3 nodes into one script and have the output dumped into one email?

Ideally each node would be headlined i.e.:

Node 1
Storage Group	Status	Replay Que Length	Last Replayed Time	Last Full Backup
SG1	Healthy	1255	10/13/2009 5:51:41 AM	10/12/2009 5:02:05 PM
SG2	Healthy	2732	10/13/2009 5:50:18 AM	10/12/2009 5:46:54 PM

Node 2
Storage Group	Status	Replay Que Length	Last Replayed Time	Last Full Backup
SG1	Healthy	1255	10/13/2009 5:51:41 AM	10/12/2009 5:02:05 PM
SG2	Healthy	2732	10/13/2009 5:50:18 AM	10/12/2009 5:46:54 PM
Node 3
Storage Group	Status	Replay Que Length	Last Replayed Time	Last Full Backup
SG1	Healthy	1255	10/13/2009 5:51:41 AM	10/12/2009 5:02:05 PM
SG2	Healthy	2732	10/13/2009 5:50:18 AM	10/12/2009 5:46:54 PM

Any help you can give is most appreciated.
Regards

Jonny Barker</description>
		<content:encoded><![CDATA[<p>Hi Matt,<br />
This script is just what I was looking for. My only problem is that I have a 3 node cluster so I need to run this as is 3 times, i.e. 3 sets of Get-StorageGroupCopyStatus -Server PRIMARYSERVER -StandbyMachine SECONDARYSERVER.<br />
Rather than schedule 3 separate powershells would there be an easy way to include all 3 nodes into one script and have the output dumped into one email?</p>
<p>Ideally each node would be headlined i.e.:</p>
<p>Node 1<br />
Storage Group	Status	Replay Que Length	Last Replayed Time	Last Full Backup<br />
SG1	Healthy	1255	10/13/2009 5:51:41 AM	10/12/2009 5:02:05 PM<br />
SG2	Healthy	2732	10/13/2009 5:50:18 AM	10/12/2009 5:46:54 PM</p>
<p>Node 2<br />
Storage Group	Status	Replay Que Length	Last Replayed Time	Last Full Backup<br />
SG1	Healthy	1255	10/13/2009 5:51:41 AM	10/12/2009 5:02:05 PM<br />
SG2	Healthy	2732	10/13/2009 5:50:18 AM	10/12/2009 5:46:54 PM<br />
Node 3<br />
Storage Group	Status	Replay Que Length	Last Replayed Time	Last Full Backup<br />
SG1	Healthy	1255	10/13/2009 5:51:41 AM	10/12/2009 5:02:05 PM<br />
SG2	Healthy	2732	10/13/2009 5:50:18 AM	10/12/2009 5:46:54 PM</p>
<p>Any help you can give is most appreciated.<br />
Regards</p>
<p>Jonny Barker</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Shadbolt</title>
		<link>http://mattlog.net/2009/03/12/auto-email-exchange-2007-storagegroupcopystatus/comment-page-1/#comment-1402</link>
		<dc:creator>Matt Shadbolt</dc:creator>
		<pubDate>Mon, 05 Oct 2009 23:27:52 +0000</pubDate>
		<guid isPermaLink="false">http://mattlog.net/?p=124#comment-1402</guid>
		<description>You need to make sure the Exchange plugin is enabled in your PowerShell. Best way to test is to run the script from EMS first - if it works there then you add the:

add-pssnapin Microsoft.Exchange.Management.PowerShell.Admin

Also, if your running the script from a PowerShell you need to set the Execution Policy correctly by:

Set-ExecutionPolicy RemoteSigned</description>
		<content:encoded><![CDATA[<p>You need to make sure the Exchange plugin is enabled in your PowerShell. Best way to test is to run the script from EMS first &#8211; if it works there then you add the:</p>
<p>add-pssnapin Microsoft.Exchange.Management.PowerShell.Admin</p>
<p>Also, if your running the script from a PowerShell you need to set the Execution Policy correctly by:</p>
<p>Set-ExecutionPolicy RemoteSigned</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Felipe</title>
		<link>http://mattlog.net/2009/03/12/auto-email-exchange-2007-storagegroupcopystatus/comment-page-1/#comment-1399</link>
		<dc:creator>Felipe</dc:creator>
		<pubDate>Mon, 05 Oct 2009 19:05:22 +0000</pubDate>
		<guid isPermaLink="false">http://mattlog.net/?p=124#comment-1399</guid>
		<description>My server will not run the script.
I have checked the security on powershell and everything seems ok. I ran the first line from the script in power shell and the get-storagegroupcopy is not recognized from powershell. any recommendations.</description>
		<content:encoded><![CDATA[<p>My server will not run the script.<br />
I have checked the security on powershell and everything seems ok. I ran the first line from the script in power shell and the get-storagegroupcopy is not recognized from powershell. any recommendations.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
