Jump to content

Recommended Posts

Posted

I'm trying to delete all Inbox, Sent Items & Deleted Items from our student mailboxes, this is the command I'm trying to run:

 

Get-MailboxDatabase “Students Database” | Export-Mailbox -TargetMailbox TESTSTUDENT -IncludeFolders "\Inbox" "\Sent Items" "\Deleted Items" -DeleteContent

 

 

All students have their own database so I've specified that, I'm trying it with just our TESTSTUDENT account first as a test, but powershell keeps throwing the error:

 

[PS] C:\Documents and Settings\Administrator.DOMAIN\Desktop>Get-MailboxDatabase

"Students Database" | Export-Mailbox -TargetMailbox TESTSTUDENT -IncludeFolders

"\Inbox" "\Sent Items" "\Deleted Items" -DeleteContent

Export-Mailbox : A positional parameter cannot be found that accepts argument '

\Deleted Items'.

At line:1 char:57

+ Get-MailboxDatabase "Students Database" | Export-Mailbox <<<< -TargetMailbox

TESTSTUDENT -IncludeFolders "\Inbox" "\Sent Items" "\Deleted Items" -DeleteCon

tent

+ CategoryInfo : InvalidArgument: ( : ) [Export-Mailbox], Parameter

BindingException

+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.Exchange.M

anagement.RecipientTasks.ExportMailbox

 

The permissions are defiantly correct, I'm wondering if anyone can spot anything wrong in my script?

 

Thanks!

Posted (edited)

I've found a different way of doing it now, using this command:

 

Get-Mailbox -OrganizationalUnit Students -Identity teststudent | Export-Mailbox -DeleteContent

 

which seems to work :)

Edited by BassTech

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...