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
Solved

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

Posted on 2015-02-05
3
84 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
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 Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
In-place Upgrading Dirsync to Azure AD Connect
In this video we show how to create a Shared Mailbox 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 Recipients >> Sha…
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…

856 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