Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to automatically send Exchange Server 2013 usage to a specified mailbox

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces you how to automatically send Exchange Server 2013 usage to the designated mailbox, the content is very detailed, interested friends can refer to, hope to be helpful to you.

Create a PS script

1. Statistics on the use of mailboxes

Get-Mailbox-ResultSize Unlimited | Get-MailboxStatistics | ft Displayname,LastLogonTime,ItemCount,TotalItemSize > D:\ OPS\ report1\ stats.csv

Using the previous script, export the results to D:\ OPS\ report1\ stats.csv

2. Send mail

$user = "mailops@xxxxxxx.com"

$PWord = ConvertTo-SecureString-String "xxxxxxx"-AsPlainText-Force

$cre = New-Object-TypeName System.Management.Automation.PSCredential-ArgumentList $User, $PWord

$att = "D:\ OPS\ report1\ stats.csv"

Send-MailMessage-Subject "Mail system usage Summary"-Body "see attachment"-Attachments $att-From $user-To "lutao@xxxxxx.com"-SmtpServer "smtp.xxxxx.com"-Port 25-Credential $cre-Encoding ([System.Text.Encoding]:: UTF8)

The explanation of the above script:

User sending mailbox

PWord sending mailbox password

Cre makes the sending mailbox and password into authorization information.

Att attachment path

Send-MailMessage send email command

-Subject message header

-Body message body

-Attachments attachment

-From Sender

-To pickup mailbox

-SmtpServer SMTP address

-Port SMTP port

-Credential outgoing mailbox and password authorization information

-Encoding ([System.Text.Encoding]:: UTF8) email code. Not adding this Chinese code is garbled.

Second, set planned tasks

1. Spell out the commands that need to be executed for the planned task

Right-click the EMS shortcut and copy the target in the properties

Constitute the command line that needs to be executed for scheduled tasks

C:\ Windows\ System32\ WindowsPowerShell\ v1.0\ powershell.exe-command ". D:\ ExchangeServer\ V15\ bin\ RemoteExchange.ps1'; Connect-ExchangeServer-auto; D:\ OPS\ report1\ report1.ps1"

The explanation of the above script

What we really need to do is schedule the PowerShell.exe and then use the-Command parameter to execute multiple statements. Here we should note that the script has multiple lines and each statement is separated by a semicolon. The first thing we do is navigate to the RemoteExchange.ps1 file in the Exchange server's bin directory, which initializes some Exchange Shel variables and imports Exchange special features. The next line of script uses the Connect-ExchangeServer call parameter-Auto to connect to the Exchange server, allowing the Exchange Management Shell environment to be loaded from the best Exchange server in the local AD site. Preferably, execute our specified script file through Exchange Management Shell.

2. Create a scheduled task

In the right-click space in the scheduled tasks interface, click "create basic tasks"

Enter the distinguished name of the scheduled task in the name box, write a description, and click next

Set the task trigger frequency, set the daily frequency, you can run multiple times a day, click "next"

Select the startup program, next step

Enter the program and script in step 1 to spell out the commands that need to be executed for the scheduled task, and click "next"

Click next will pop up the following prompt box, click "Yes"

Check "Open the dialog box for this task properties when you click finish", click finish to complete the creation of the basic task

Ensure that the scheduled task operation account has administrative access to the Exchange organization. Similarly, when the server enables user account control (UAC), you may need to enable the highest permission to run the scheduled task in the scheduled task option, and we also want to enable it to run regardless of whether the user logs in or not, as shown below:

Scheduled task creation completed

Run the task manually, right-click, and you can see the results in the mailbox.

On how to automatically send Exchange Server 2013 usage to the designated mailbox to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report