将邮件从 x 个文件夹移动到 Exchange 邮箱中的 1 个文件夹的脚本
我们有一台 Exchange 2007 服务器,有很多邮箱。我们习惯于使用很多文件夹并将邮件放入这些子文件夹中。我想要一个包含邮箱和邮箱总大小、项目计数和文件夹计数的列表,因此我编写了以下脚本。
Get-MailboxStatistics | where {$_.ObjectClass –eq “Mailbox”} | Sort-Object TotalItemSize –Descending | Foreach-Object{
$mbx = $_
$count = 0
$mbx | Get-MailboxFolderStatistics | Foreach-Object{ $count++ }
$mbx | Select-Object @{label='DisplayName';expression={$mbx.DisplayName}}, @{label='Total Size (MB)';expression={$mbx.TotalItemSize.Value.ToMB()}},@{label='Items';expression={$mbx.ItemCount}}, @{label='Folders';expression={$count}}
} > c:\mailboxes.txt
这非常有效,但我们希望将交换的文件夹数量限制为 10 个子文件夹(例如)。我想知道是否有解决方案将邮件从所有文件夹移动到 1 个子文件夹并删除空文件夹。
你们有没有powershell的解决方案(c#也可以)
We have an exchange 2007 server with a lot of mailboxes. We are used to use a lot of folders and drop the messages in this subfolders. I want a list with mailboxes and the total size of the mailbox, the itemcount and the count of folders so I wrote the following script.
Get-MailboxStatistics | where {$_.ObjectClass –eq “Mailbox”} | Sort-Object TotalItemSize –Descending | Foreach-Object{
$mbx = $_
$count = 0
$mbx | Get-MailboxFolderStatistics | Foreach-Object{ $count++ }
$mbx | Select-Object @{label='DisplayName';expression={$mbx.DisplayName}}, @{label='Total Size (MB)';expression={$mbx.TotalItemSize.Value.ToMB()}},@{label='Items';expression={$mbx.ItemCount}}, @{label='Folders';expression={$count}}
} > c:\mailboxes.txt
This works great but we want to restrict the number of folders in exchange to 10 subfolders (for example). I wonder if there is an solution to move messages from all folders to 1 subfolder and remove the empty folders.
Does any of you have an solution for powershell (c# is also possible)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我看到了几种可能性。
使用export-mailbox将所有电子邮件从您要删除的文件夹导出到您想要保留的文件夹。
使用 Exchange Web 服务(通过 EWS 托管 API)将项目从要删除的文件夹移动到要保留的文件夹。
I see a couple of possibilites.
Use export-mailbox to export all the email from the folders you want to delete to one you want to keep.
Use Exchange Web Services (via the EWS Managed API) to move the items from the folders you want to delete to the one you want to keep.