Reputation: 41
Hi Stackoverflow people,
I have been trying to use the Get-MailboxPermission cmdlet to run a report on all my mailboxes. I have run this piece of code (many times)
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://Exchange Server/PowerShell/ -Authentication Kerberos -Credential $UserCredential
Import-PSSession $Session
Which has given me othe exchange cmdlets, like Get-Mailbox. The message I receive when trying to run the command is as below
Get-MailboxPermission : The term 'Get-MailboxPermission' 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.
At line:1 char:1
+ Get-MailboxPermission
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-MailboxPermission:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
What am I doing wrong?!
Upvotes: 2
Views: 22540
Reputation:
Use this command to enable exchange functionality:
add-pssnapin *exchange* -erroraction SilentlyContinue
Then use the Get-Mailbox command.
Upvotes: 2
Reputation: 41
Figured out that I did not have the correct permissions to get these cmdlets, thanks to mjolinor for pointing me in the right direction (dont know why i didnt think about that in the first place).
Not sure which RBAC role this cmdlet is associated with, but when you do that Import-PSSession, you'll get a module of functions customized to the RBAC roles you belong to. If you're not in an RBAC role that allows viewing those permission you won't have that cmdlet available. – mjolinor 9 hours ago
Upvotes: 0