Khari Turner
asked on
Powershell Script to delete all emails before 1/1/17
I would like a powershell script that deletes all emails older than January 1st, 2017 in microsoft exchange
What version of exchange are you?
Jose
Jose
ASKER
My version is 14.3.361.4001, so i think 2010
Yes to be exact: Update Rollup 18 for Exchange Server 2010 SP3
Source: https://technet.microsoft.com/en-us/library/hh135098%28v=exchg.150%29.aspx?f=255&MSPPError=-2147217396
Do you need to delete the emails in all mailboxes? or just in one specific one?.
jose
Source: https://technet.microsoft.com/en-us/library/hh135098%28v=exchg.150%29.aspx?f=255&MSPPError=-2147217396
Do you need to delete the emails in all mailboxes? or just in one specific one?.
jose
ASKER
Yes I need to delete ALL of the mailboxes of all files that predate 1/1/2017. I just tried:
Get-Mailbox -Identity “User” | Search-Mailbox -identity "User" -SearchQuery 'Received<01/24/2018' -DeleteContent -force
Just to Test and see if I could delete some emails from my mail box that predate January 24th but I get the error:
Get-Mailbox : The term 'Get-Mailbox' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Get-Mailbox -Identity “User” | Search-Mailbox -identity "User" -SearchQuery 'Received<01/24/2018' -DeleteContent -force
Just to Test and see if I could delete some emails from my mail box that predate January 24th but I get the error:
Get-Mailbox : The term 'Get-Mailbox' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Yes, that's why I asked the version of exchange.
That command should work, are you using the powershell command for exchange?
Source:https://technet.microsoft.com/en-us/library/bb123685(v=exchg.141).aspx
jose
That command should work, are you using the powershell command for exchange?
Source:https://technet.microsoft.com/en-us/library/bb123685(v=exchg.141).aspx
jose
ASKER
Yes I am, I'm trying to use it for Microsoft Outlook
I mean you need to run the script on the Exchange Console for 2010.
https://technet.microsoft.com/en-us/library/bb123778(v=exchg.141)
https://technet.microsoft.com/en-us/library/bb123778(v=exchg.141)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
done
Open in new window