Forum

Exchange Management...
 
Bildirimler
Hepsini Temizle

Exchange Management Shell hk

4 Yazılar
3 Üyeler
0 Reactions
355 Görüntüleme
(@Anonim)
Gönderiler: 0
Konu başlatıcı
 

Exchange management shell uzerinde gunluk olarak olarak çalışması gereken bir komut var ve bu komutu çalıştırdıktan sonra bana sonucları mail olarak gönderilmesi gerekiyor.


Komutlar bunlar:


Get-MailboxStatistics -server EXCMBX01 | Where {$_.StorageLimitStatus -ne 'BelowLimit'} | ft DisplayName, TotalItemSize, ItemCount, storagelimitstatus


Get-MailboxStatistics -server EXCMBX02 | Where {$_.StorageLimitStatus -ne 'BelowLimit'} | ft DisplayName, TotalItemSize, ItemCount, storagelimitstatus


Get-MailboxStatistics -server EXCMBX03 | Where {$_.StorageLimitStatus -ne 'BelowLimit'} | ft DisplayName, TotalItemSize, ItemCount, storagelimitstatus


Get-MailboxStatistics -server EXCMBX04 | Where {$_.StorageLimitStatus -ne 'BelowLimit'} | ft DisplayName, TotalItemSize, ItemCount, storagelimitstatus


Get-MailboxStatistics -server EXCMBX05 | Where {$_.StorageLimitStatus -ne 'BelowLimit'} | ft DisplayName, TotalItemSize, ItemCount, storagelimitstatus


Get-MailboxStatistics -server EXCMBX06 | Where {$_.StorageLimitStatus -ne 'BelowLimit'} | ft DisplayName, TotalItemSize, ItemCount, storagelimitstatus


Çalıştıktan sonra mail olarak nasıl gönderilmesini sağlayabilirim?

 
Gönderildi : 12/04/2012 17:33

(@rafets-ayata)
Gönderiler: 3820
Üye
 

Merhaba,


Bu komutları bir powershell komut dosyası olarak hazırlarsanız ve sonuna bunu mail attırabilirsiniz.


.\MyScript.ps1 > output.txt


Yukarıdaki örnek gibi dışa komut çıktıları aldırıp daha sonra aşağıdaki gibi komut sistemini kullanıp mail attırabilirsiniz. 


$filename = “logfile.txt”
$smtpServer = “localhost”


$msg = new-object Net.Mail.MailMessage
$att = new-object Net.Mail.Attachment($filename)
$smtp = new-object Net.Mail.SmtpClient($smtpServer)


$msg.From = “[email protected]
$msg.To.Add(”[email protected]”)
$msg.Subject = “Nightly Log File”
$msg.Body = “The nightly log file is attached”
$msg.Attachments.Add($att)


$smtp.Send($msg)


 


Not : Alıntıdır. Örnek amaçlı eklenmiştir.

 
Gönderildi : 12/04/2012 18:17

(@Anonim)
Gönderiler: 0
Konu başlatıcı
 

komutu calıstırdıgımda şöyle bir hata alıyorum


 


Exception calling "Send" with "1" argument(s): "Failure sending mail."
At line:1 char:11
+ $smtp.Send <<<< ($msg)
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

 
Gönderildi : 12/04/2012 20:15

(@canbolat)
Gönderiler: 1253
Noble Member
 

Merhaba ,

Buna benzer bir script hazırlamıştım.Dilerim yardımcı olur.

http://www.cozumpark.com/forums/post/304886.aspx

 
Gönderildi : 12/04/2012 20:25

Paylaş: