Aug 03 2018 08:04 AM - edited Aug 03 2018 08:19 AM
I am trying to work with the Search-Mailbox cmdlet to copy email from one user to another.
I start a PS windows as Admin.
Connect to O365
Import-Module MSOnline
$cred = Get-Credential -Message 'enter info' -UserName 'XXXX MY User XXXX'
Connect-MsolService -Credential $cred
I set some variables and use this command
Search-Mailbox $SourceUserName -TargetMailbox "$TargetUserName" -TargetFolder "$TargetFolderName=" -LogLevel Full
I get this response back:
Search-Mailbox : The term 'Search-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.
I check the O365-Exchange admin center and I am a member of the Discovery Management group / admin roles.
So now I am out of guesses. I simply don't have the cmdlet available. Is there a module I am suppose to load?
Aug 03 2018 10:38 AM
You need to be a member of the Mailbox Import Export or the Mailbox Search role:
Get-ManagementRole -Cmdlet Search-Mailbox -CmdletParameters TargetMailbox Name RoleType ---- -------- Mailbox Import Export MailboxImportExport Mailbox Search MailboxSearch