Forum Discussion
Get-MessageTraceV2 not recognized
Hi begberts​,
I can't see any references to environment limitations on learn.microsoft.com, so I can't comment on whether being a government cloud matters in this instance, but if we set that one aspect aside, you can run the following command to check if the eligible RBAC roles your account would need to be a member of in order to see and run Get-MessageTraceV2:
Get-ManagementRole -Cmdlet "Get-MessageTraceV2" -CmdletParameters "StartDate", "EndDate", "SenderAddress", "Status" | ForEach-Object {
Get-ManagementRoleAssignment -Role $_.Name -Delegating $false;
} | Sort-Object -Property RoleAssigneeName, Role | Format-Table -AutoSize -Property Role, RoleAssigneeType, RoleAssigneeName;
The column you're interested in is RoleAssigneeName, where your account would need to be in at least one of the listed roles. As an example of the output, this is what I get for my environment:
As a side note, you've made a syntax error within your $params HashTable, though this doesn't explain the error you're seeing (you'd get a different error if this mattered). DateEndDate should simply be EndDate.
Lastly, Get-Command should only be listing the version imported dynamically by the ExchangeOnlineManagement module as shown below:
Cheers,
Lain