<?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>Комментарии: Powershell &#8211; Отправка отчетов.</title>
	<atom:link href="http://blog.wadmin.ru/2010/02/send-reports-via-powershell/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.wadmin.ru/2010/02/send-reports-via-powershell/</link>
	<description>Записки сисадмина</description>
	<lastBuildDate>Tue, 07 Feb 2012 15:05:31 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>Автор: admin</title>
		<link>http://blog.wadmin.ru/2010/02/send-reports-via-powershell/comment-page-1/#comment-276</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Fri, 03 Dec 2010 08:00:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.wadmin.ru/?p=651#comment-276</guid>
		<description>не пробовал отправку с SSL. просто не было задачи.</description>
		<content:encoded><![CDATA[<p>не пробовал отправку с SSL. просто не было задачи.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Автор: admin</title>
		<link>http://blog.wadmin.ru/2010/02/send-reports-via-powershell/comment-page-1/#comment-275</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Fri, 03 Dec 2010 07:57:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.wadmin.ru/?p=651#comment-275</guid>
		<description>у меня замечательно пашет вот такая конструкция.
правда приходится сначала формировать HTML файл...

# send_notify.ps1
# version 0.2

function send-notify {
param([string]$ToAddress=(Throw &#039;$ToAddress is required!&#039;))

  $SendingServer = &quot;xx.xx.xx.xx&quot;
  $addresses = $ToAddress
  if($ToAddress -isnot [Object[]]) {
    $addresses = ([string]$ToAddress).Split(&quot;;&quot;)
  }

  $SMTPMessage = New-Object System.Net.Mail.MailMessage 
  $SMTPMessage.Body = Get-Content &quot;C:\Program Files\Tools\report\template.htm&quot;
  $SMTPMessage.IsBodyHtml = $true
  $SMTPMessage.From = &quot;service.desk@domain.com&quot;
  $SMTPMessage.Subject = &quot;Daily report&quot;

  foreach($singleAddress in $addresses) {
    $SMTPMessage.BCC.Add($singleAddress)
  }

  $Attachment = New-Object System.Net.Mail.Attachment &quot;C:\Program Files\Tools\report\alert.png&quot;
  $SMTPMessage.Attachments.Add($Attachment)

  $SMTPClient = New-Object System.Net.Mail.SMTPClient $SendingServer
  
  $Credentials = new-object System.Net.networkCredential
  $Credentials.domain = &quot;DOMAIN&quot;
  $Credentials.UserName = &quot;noreply&quot;
  $Credentials.Password = &quot;P@$$W0rd&quot;
  $SMTPClient.Credentials = $Credentials

  $SMTPClient.Send($SMTPMessage)
}

#
send-notify &quot;&lt; user1@domain.com &gt;;&lt; user2@domain.com &gt;&quot;</description>
		<content:encoded><![CDATA[<p>у меня замечательно пашет вот такая конструкция.<br />
правда приходится сначала формировать HTML файл&#8230;</p>
<p># send_notify.ps1<br />
# version 0.2</p>
<p>function send-notify {<br />
param([string]$ToAddress=(Throw &#8216;$ToAddress is required!&#8217;))</p>
<p>  $SendingServer = &laquo;xx.xx.xx.xx&raquo;<br />
  $addresses = $ToAddress<br />
  if($ToAddress -isnot [Object[]]) {<br />
    $addresses = ([string]$ToAddress).Split(&laquo;;&raquo;)<br />
  }</p>
<p>  $SMTPMessage = New-Object System.Net.Mail.MailMessage<br />
  $SMTPMessage.Body = Get-Content &laquo;C:\Program Files\Tools\report\template.htm&raquo;<br />
  $SMTPMessage.IsBodyHtml = $true<br />
  $SMTPMessage.From = &laquo;service.desk@domain.com&raquo;<br />
  $SMTPMessage.Subject = &laquo;Daily report&raquo;</p>
<p>  foreach($singleAddress in $addresses) {<br />
    $SMTPMessage.BCC.Add($singleAddress)<br />
  }</p>
<p>  $Attachment = New-Object System.Net.Mail.Attachment &laquo;C:\Program Files\Tools\report\alert.png&raquo;<br />
  $SMTPMessage.Attachments.Add($Attachment)</p>
<p>  $SMTPClient = New-Object System.Net.Mail.SMTPClient $SendingServer</p>
<p>  $Credentials = new-object System.Net.networkCredential<br />
  $Credentials.domain = &laquo;DOMAIN&raquo;<br />
  $Credentials.UserName = &laquo;noreply&raquo;<br />
  $Credentials.Password = &laquo;P@$$W0rd&raquo;<br />
  $SMTPClient.Credentials = $Credentials</p>
<p>  $SMTPClient.Send($SMTPMessage)<br />
}</p>
<p>#<br />
send-notify &laquo;< <a href="mailto:user1@domain.com">user1@domain.com >;< <a href="mailto:user2@domain.com">user2@domain.com >&raquo;</p>
]]></content:encoded>
	</item>
	<item>
		<title>Автор: kkvkkv</title>
		<link>http://blog.wadmin.ru/2010/02/send-reports-via-powershell/comment-page-1/#comment-274</link>
		<dc:creator>kkvkkv</dc:creator>
		<pubDate>Fri, 03 Dec 2010 07:56:16 +0000</pubDate>
		<guid isPermaLink="false">http://blog.wadmin.ru/?p=651#comment-274</guid>
		<description>и еще вопрос.
а если я настраиваю авторизацию при отправке он типа ssl тоже задействует? т.е. я через exchange смогу отпарвить его ? 
# Задаем пользователя от имени которого будет происходить отправка
$Credentials = new-object System.Net.networkCredential
$Credentials.domain = &quot;DOMAIN&quot;
$Credentials.UserName = &quot;user.name&quot;
$Credentials.Password = &quot;P@$$W0rd&quot;
$smtp.Credentials = $Credentials</description>
		<content:encoded><![CDATA[<p>и еще вопрос.<br />
а если я настраиваю авторизацию при отправке он типа ssl тоже задействует? т.е. я через exchange смогу отпарвить его ?<br />
# Задаем пользователя от имени которого будет происходить отправка<br />
$Credentials = new-object System.Net.networkCredential<br />
$Credentials.domain = &laquo;DOMAIN&raquo;<br />
$Credentials.UserName = &laquo;user.name&raquo;<br />
$Credentials.Password = &laquo;P@$$W0rd&raquo;<br />
$smtp.Credentials = $Credentials</p>
]]></content:encoded>
	</item>
	<item>
		<title>Автор: admin</title>
		<link>http://blog.wadmin.ru/2010/02/send-reports-via-powershell/comment-page-1/#comment-273</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Fri, 03 Dec 2010 07:49:01 +0000</pubDate>
		<guid isPermaLink="false">http://blog.wadmin.ru/?p=651#comment-273</guid>
		<description>Действительно в формировании HTML есть определенные косяки, иногда проходит иногда нет.

Предложенный вами способ тоже заслуживает внимания.</description>
		<content:encoded><![CDATA[<p>Действительно в формировании HTML есть определенные косяки, иногда проходит иногда нет.</p>
<p>Предложенный вами способ тоже заслуживает внимания.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Автор: kkvkkv</title>
		<link>http://blog.wadmin.ru/2010/02/send-reports-via-powershell/comment-page-1/#comment-272</link>
		<dc:creator>kkvkkv</dc:creator>
		<pubDate>Fri, 03 Dec 2010 07:46:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.wadmin.ru/?p=651#comment-272</guid>
		<description>он порезал 
$OutStrings = &quot;(html)(body)&quot;
$OutStrings = OutStrings + &quot;(/html)(/body)&quot;</description>
		<content:encoded><![CDATA[<p>он порезал<br />
$OutStrings = &laquo;(html)(body)&raquo;<br />
$OutStrings = OutStrings + &laquo;(/html)(/body)&raquo;</p>
]]></content:encoded>
	</item>
	<item>
		<title>Автор: kkvkkv</title>
		<link>http://blog.wadmin.ru/2010/02/send-reports-via-powershell/comment-page-1/#comment-271</link>
		<dc:creator>kkvkkv</dc:creator>
		<pubDate>Fri, 03 Dec 2010 07:45:32 +0000</pubDate>
		<guid isPermaLink="false">http://blog.wadmin.ru/?p=651#comment-271</guid>
		<description>проблема в самом формировании HTML 
мне требовалось просто перевести TXT  -&gt; HTML 
пришлось вот так сделать

$StringsFile = get-content $BackuplogPath
$OutStrings = &quot;&quot;
foreach($StringsFile1 in $StringsFile){ $OutStrings = $OutStrings + $StringsFile1 + &quot;&quot; }
$OutStrings = $OutStrings + &quot;&quot;
 
можно и красивее, но как то так</description>
		<content:encoded><![CDATA[<p>проблема в самом формировании HTML<br />
мне требовалось просто перевести TXT  -&gt; HTML<br />
пришлось вот так сделать</p>
<p>$StringsFile = get-content $BackuplogPath<br />
$OutStrings = &laquo;&raquo;<br />
foreach($StringsFile1 in $StringsFile){ $OutStrings = $OutStrings + $StringsFile1 + &laquo;&raquo; }<br />
$OutStrings = $OutStrings + &laquo;&raquo;</p>
<p>можно и красивее, но как то так</p>
]]></content:encoded>
	</item>
	<item>
		<title>Автор: admin</title>
		<link>http://blog.wadmin.ru/2010/02/send-reports-via-powershell/comment-page-1/#comment-269</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Fri, 03 Dec 2010 06:48:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.wadmin.ru/?p=651#comment-269</guid>
		<description>добавляли вот это?

$mail.IsBodyHtml = $true</description>
		<content:encoded><![CDATA[<p>добавляли вот это?</p>
<p>$mail.IsBodyHtml = $true</p>
]]></content:encoded>
	</item>
	<item>
		<title>Автор: kkvkkv</title>
		<link>http://blog.wadmin.ru/2010/02/send-reports-via-powershell/comment-page-1/#comment-268</link>
		<dc:creator>kkvkkv</dc:creator>
		<pubDate>Fri, 03 Dec 2010 05:07:34 +0000</pubDate>
		<guid isPermaLink="false">http://blog.wadmin.ru/?p=651#comment-268</guid>
		<description>я когда делаю $BodyText = get-content C:\ReportVM\Backuplog_2010122_171344.txt &#124; ConvertTo-Html
то у меня вообще получается что-то странное выдается когда делаю вывод $BodyText</description>
		<content:encoded><![CDATA[<p>я когда делаю $BodyText = get-content C:\ReportVM\Backuplog_2010122_171344.txt | ConvertTo-Html<br />
то у меня вообще получается что-то странное выдается когда делаю вывод $BodyText</p>
]]></content:encoded>
	</item>
	<item>
		<title>Автор: admin</title>
		<link>http://blog.wadmin.ru/2010/02/send-reports-via-powershell/comment-page-1/#comment-267</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Thu, 02 Dec 2010 10:28:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.wadmin.ru/?p=651#comment-267</guid>
		<description>забыл добавить...
  $mail.IsBodyHtml = $true</description>
		<content:encoded><![CDATA[<p>забыл добавить&#8230;<br />
  $mail.IsBodyHtml = $true</p>
]]></content:encoded>
	</item>
	<item>
		<title>Автор: admin</title>
		<link>http://blog.wadmin.ru/2010/02/send-reports-via-powershell/comment-page-1/#comment-266</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Thu, 02 Dec 2010 10:13:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.wadmin.ru/?p=651#comment-266</guid>
		<description>$mail.Body = Get-Content filename.txt &#124; ConvertTo-Html</description>
		<content:encoded><![CDATA[<p>$mail.Body = Get-Content filename.txt | ConvertTo-Html</p>
]]></content:encoded>
	</item>
</channel>
</rss>

