Solved

Search-Mailbox command to delete messages will not run using Powershell script

Posted on 2015-02-05
3
86 Views
Last Modified: 2015-03-10
Experts,

I have tried to run this script as directed by my research but it still gives me a " position parameter cannot be found that accepts argument ' -DeleteContent'

[PS] C:\Windows\system32>Search-Mailbox -Identity root-arl -SearchQuery "Received:<$(01/01/2015)", "From:(root@ARLCTXLOG
)" -DeleteContent -Force

I do not want to send these log file emails to another mailbox folder but get rid of them perm.

thanks!
0
Comment
Question by:Russ Wrightson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 19

Expert Comment

by:Miguel Angel Perez Muñoz
ID: 40593096
User running this command has delegated permissions on root-arl mailbox? Or you can add user running this command to Mailbox import export role: https://technet.microsoft.com/en-us/library/dd638205.aspx
0
 
LVL 24

Accepted Solution

by:
VB ITS earned 500 total points
ID: 40593289
You will need to have the Mailbox Import Export management role assigned to your admin account first before you can use the -DeleteContent switch. By default this role isn't included in any of the built-in role groups in Exchange.

Run the below commands to first create the role group and assign it the Mailbox Import Export role, then add your admin account to this new role group:
New-RoleGroup "Mailbox Import Export Admins" -Roles "Mailbox Import Export"
Add-RoleGroupMember "Mailbox Import Export Admins" -Member "Your Admin Account"

Open in new window

Keep in mind that you can call the role group anything you like, it doesn't necessarily have to be named Mailbox Import Export Admins as outlined above.
0
 

Author Comment

by:Russ Wrightson
ID: 40657550
Never got the email notification on this one.

thanks VB ITS!
0

Featured Post

Free Webinar: AWS Backup & DR

Join our upcoming webinar with experts from AWS, CloudBerry Lab, and the Town of Edgartown IT to discuss best practices for simplifying online backup management and cutting costs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Scam emails are a huge burden for many businesses. Spotting one is not always easy. Follow our tips to identify if an email you receive is a scam.
Find out what you should include to make the best professional email signature for your organization.
In this video we show how to create a mailbox database in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Servers >> Data…
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question