Search Users mailbox : HR Approved

If you get asked to see if people have a message in their inboxes, or more commonly can you delete the message sent with the subject "Payrise" from a list of peoples mailboxes.

Then the answer is yes you can, however this does not require you to be a "Full Admin" of the mailbox as then you can read other peoples mails, which is a big HR no-no, instead try this is powershell:

get-mailbox xxx | Search-Mailbox  -SearchQuery "Payrise" -EstimateResultOnly

Replace xxx with the user alias

This will include all search results with "Payrise" in the subject, however bear in mind this a loose fit, so if the subject says "Payrise with benefits" that is also included :)

This is an example of the output:

RunspaceId       : 3d9369ff-d962-4958-gg56-2495ccf51355
Identity         : stwater.intra/Departments/unicorn/milking
TargetMailbox    :
Success          : True
TargetFolder     :
ResultItemsCount : 330
ResultItemsSize  : 24.56 MB (25,756,804 bytes)

This means the search has found 330 items, obviously you cannot view these messages as that defeats the point of HR safe.

Then to delete the messages use this:

get-mailbox xxx | Search-Mailbox  -SearchQuery "Cyber" -DeleteContent

I found this helpful for auto archived mails, if I wanted to target all those mail, I would use this command as all our archive mails have this in in the subject......

get-mailbox xxx | Search-Mailbox  -SearchQuery "This message has been archived" -DeleteContent
Previous Post Next Post

نموذج الاتصال