Exporting MailBoxStatistics issue
I am running this script saved as getmailstats.ps1 $Day = (Get-Date).day $Month = (Get-Date).month $Year = (Get-Date).Year $mailbox1 = "Mailbox Report for $Day/$Month/$Year`n" $mailbox2 = Get-MailBoxStatistics | where {"IssueWarning","ProhibitSend","MailboxDisabled" -contains $_.StorageLimitStatus} | sort-object storagelimitstatus -Descending | ft DisplayName, StorageLimitStatus, LastLogonTime | Out-String $mailbox3 = Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | ft DisplayName,@{label="TotalItemSize(MB)";expression={$_.TotalItemSize.Value.ToMB()}},ItemCount | Out-String $messagesubject = "Daily Mailbox Usage Report" $mailboxfinal = $mailbox1 + $mailbox2 + $mailbox3 $messagesubject = "Daily Mailbox Usage Report" $mailboxfinal = $mailbox1 + $mailbox2 $SmtpClient = new-object system.net.mail.smtpClient $MailMessage = New-Object system.net.mail.mailmessage $SmtpClient.Host = "localhost" $mailmessage.from = "reports@root.local" $mailmessage.To.add("First.last@root.local") $mailmessage.Subject = $messagesubject $mailmessage.Body = $mailboxfinal $smtpclient.Send($mailmessage)When i run it i get this error$smtpclient.Send($mailmessage)\Windows\System32>getmailstats.ps1Exception calling "Send" with "1" argument(s): "Service not available, closing transmission channel. The server response was: 4.3.2 Service not available, closing transmission channel"At C:/Windows\system32\getmailstats.ps1:18 char:17+ $smtpclient.Send( <<<< $mailmessage)Anyone have any suggestion on what i am doing wrongThank youKen
March 18th, 2010 4:38pm

Hi Ken,The exeption in this error is the SMTP host, which in your above script is 'localhost'""Service not available, closing transmission channel. The server response was: 4.3.2 Service not available, closing transmission channel""Is the response the SMTP server is replying with.Ensure you can telnet to 'localhost' and succesfully send an email.OliverOliver Moazzezi | Exchange MVP, MCSA:M, MCTS:Exchange 2010, BA (Hons) Anim | http://www.exchange2007.com | http://www.exchange2010.com | http://www.cobweb.com |
Free Windows Admin Tool Kit Click here and download it now
March 18th, 2010 8:06pm

I just put localhost in instead of the actual server name it is an exchange 2007 sever so it doesnt have SMTP so I guess i need to use another smtp server
March 18th, 2010 9:25pm

You should be able to point it to your HT server.-- Ed Crowley MVP"There are seldom good technological solutions to behavioral problems.". "kenrfoster" wrote in message news:f84345f4-bb5e-44df-ac60-392b73e3c4ca...I just put localhost in instead of the actual server name it is an exchange 2007 sever so it doesnt have SMTP so I guess i need to use another smtp server Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."
Free Windows Admin Tool Kit Click here and download it now
March 18th, 2010 10:58pm

I have run the script on the CAS/HT server in the lab (Exchange 2007 SP1: One MBX, and one CAS/HT), and changed some values in the script ========================== $mailbox2 = Get-MailBoxStatistics -Server MBX | where {"IssueWarning","ProhibitSend","MailboxDisabled" -contains $_.StorageLimitStatus} | sort-object storagelimitstatus -Descending | ft DisplayName, StorageLimitStatus, LastLogonTime | Out-String $mailbox3 = Get-MailboxStatistics -Server MBX | Sort-Object TotalItemSize -Descending | ft DisplayName,@{label="TotalItemSize(MB)";expression={$_.TotalItemSize.Value.ToMB()}},ItemCount | Out-String $SmtpClient.Host = "CAS/HT server" ========================== After run the script, the error I got is: “The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.1 client was not authenticated” So I created receive connector and grant anonymous permission “Service not available, closing transmission channel. The server response was: 4.4.1 Connection timed out” So I set the “ConnectionTimeout” to “01:00:00” on the receive connector. After that, the mail can be delivered successfully If you have further question about script, please use the “Development” forum which would be the best place for the questionJames Luo TechNet Subscriber Support (http://technet.microsoft.com/en-us/subscriptions/ms788697.aspx) If you have any feedback on our support, please contact tngfb@microsoft.com
March 19th, 2010 8:47am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics