Forum Discussion
Missing Search-Mailbox Command in my imported session
- Apr 25, 2017
You need to be a member of one of the following Roles:
[21:18:56][O365]# Get-ManagementRole -Cmdlet Search-Mailbox
Name RoleType
---- --------
Mailbox Import Export MailboxImportExport
Mailbox Search MailboxSearchAdd yourself, reload the cmdlets and you should be good to go.
Use Search-Malbox with care btw, one typo and you're updating your CV... :)
You need to be a member of one of the following Roles:
[21:18:56][O365]# Get-ManagementRole -Cmdlet Search-Mailbox
Name RoleType
---- --------
Mailbox Import Export MailboxImportExport
Mailbox Search MailboxSearch
Add yourself, reload the cmdlets and you should be good to go.
Use Search-Malbox with care btw, one typo and you're updating your CV... :)
- Daniel WesterdaleApr 26, 2017Iron Contributor
VasilMichev wrote:You need to be a member of one of the following Roles:
[21:18:56][O365]# Get-ManagementRole -Cmdlet Search-Mailbox
Name RoleType
---- --------
Mailbox Import Export MailboxImportExport
Mailbox Search MailboxSearchAdd yourself, reload the cmdlets and you should be good to go.
Use Search-Malbox with care btw, one typo and you're updating your CV... :)
VasilMichev thanks for the advice. I started reading through the technet PS documentation yesterday. Then I realised yesterday I got a colleague to add me to the Discovery managment Group.
I had initially tested with a new session and the commandlet wasn't apparent. Having retested and I now have my Search-mailbox commandlet ( which is why I marked this thread as answered) . .However, things are not so simple ..........
Get-Mailbox -ResultSize unlimited | Search-Mailbox -SearchQuery {Subject:"Wy I need to update my CV*"}
The target mailbox or .pst file path is required.
+ CategoryInfo : InvalidArgument: (:) [], ArgumentException
+ FullyQualifiedErrorId : [Server=HE1PR0501MB2716,RequestId=a57a686e-e78b-4bb5-9685-dfc3fe05f276,TimeSt
amp=26/04/2017 14:38:35] [FailureCategory=Cmdlet-ArgumentException] 8C2A5F3A
+ PSComputerName : outlook.office365.comRightly or wrongly I assumed that maybe I needed to have delegated permissions for each mailbox - can I undo this if this isn't necessary
Get-Mailbox -ResultSize unlimited -Filter {(RecipientTypeDetails -eq 'UserMailbox')} | Add-MailboxPermission -User darth.vader@deathstar.onmicrosoft.com -AccessRights FullAccess -InheritanceType all
However, I still don't get passed the error shown above.
- VasilMichevApr 26, 2017MVP
You need to provide a (discovery) mailbox to store the results in, this is done via the -TargetMailbox and -TargetFolder parameters. Alaternatively, you can use eDiscovery from the UI, which gives you the option to Preview search results without copying them to a mailbox.
- Daniel WesterdaleApr 27, 2017Iron Contributor
VasilMichev wrote:You need to provide a (discovery) mailbox to store the results in, this is done via the -TargetMailbox and -TargetFolder parameters. Alaternatively, you can use eDiscovery from the UI, which gives you the option to Preview search results without copying them to a mailbox.
I have retried with part of the orignal email subject ( wasn't sure if i needed a wildcard) and when the email was sent / received .
Get-Mailbox -ResultSize unlimited | Search-Mailbox -SearchQuery 'Subject:"Attendance Something" AND Received:"23/04/2017"' -TargetFolder "Searchlog" -TargetMailbox daniel.theadmin@domain.onmicrosoft.com
There is progress reported however, the output generated in my Searchlog tells me it has failed - around 20 mailboxes are causing it problems : The operation couldn't be performed because 'Natalie Somebody' matches multiple entries. I am tempted to switch on further logging to get to the bottom of this.
The eDiscovery search is a lot easier but I think you need to add each mailbox location individually. We tried with a couple and got reasonable output.