--Create new AD Microsoft Exchange Security Group (which can be found under AD Users and Computers > Domain > Microsoft Exchange Security Groups)
New-RoleGroup
"Mailbox Move History Access"
--Find existing Permission Template
Get-ManagementRole -Cmdlet Get-MailboxStatistics
--We choose
"View-Only Recipients"
as it contains cmdlet
"Get-MailboxStatistics"
as proven with
below
....
$RoleEntries = Get-ManagementRole
| Get-ManagementRoleEntry
--Create new Permission Role
New-ManagementRole -Name
"MailboxMoveHistory"
-Description
"Allows using the -IncludeMoveHistory switch on the Get-MailboxStatistics cmdlet"
-Parent
--Modify Permission Entries in
Role
$mmh = Get-ManagementRole
$mmh | Get-ManagementRoleEntry | Where {$_.Name -ne “Get-MailboxStatistics”} | Remove-ManagementRoleEntry -confirm:$false
--Confirm only one cmdlet Entry remains which is our
$mmh | Get-ManagementRoleEntry
--Ensure Mailbox History has IncludeMoveHistory and Identity as the only parameters
Set-ManagementRoleEntry -Identity
"MailboxMoveHistory\Get-MailboxStatistics"
-Parameters Archive,Database,Debug,DomainController,ErrorAction,ErrorVariable,IncludeMoveReport,OutBuffer,OutVariable,Server,Verbose,WarningAction,WarningVariable -RemoveParameter
-Parameters Identity -AddParameter
-Parameters IncludeMoveHistory -AddParameter
--Assign Role to Created Group
New-ManagementRoleAssignment -SecurityGroup
-Role
--Now in AD Users and Computers, find the Mailbox Move History Access and add memberships of who you want to be able to get the Move History of a Mailbox
--You will now be able to use Exchange Management Shell as the user and use the command Get-MailboxStatistics and be able to find and use the -IncludeMoveHistory switch!
--Optionally you could also create a remote exchange powershell session as well (though you have less features at your disposal and most objects are returned as a string), if you know an Exchange Server to connect to:
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://YOUREXCHANGESERVER/PowerShell/ -Authentication Kerberos
Import-PSSession $Session -DisableNameChecking
$stats = (Get-MailboxStatistics -Identity MAILBOXALIAS -IncludeMoveHistory)
$stats.MoveHistory
Remove-PSSession $Session