Skip to content
This repository has been archived by the owner on Jan 21, 2021. It is now read-only.

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. #37

Open
JamesHeathcote opened this issue Aug 8, 2018 · 1 comment

Comments

@JamesHeathcote
Copy link

JamesHeathcote commented Aug 8, 2018

DumpDelegatesandForwardingRules.ps1

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:23 char:23

  • $UserDelegates += Get-MailboxPermission -Identity $User.UserPrinc ...
    
  •                   ~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : ObjectNotFound: (Get-MailboxPermission:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException
@PsychoData
Copy link

@JamesHeathcote
Can we get a more complete output? Most likely your Exchange PSSession just didn't work (bad login, MFA, or some other thing), and so it didn't import the module with the Commands

Might could also be Exchange Permissions being too low on your user.
Try these lines again and see if it imports commands.

$ExoSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $userCredential -Authentication Basic -AllowRedirection
Import-PSSession $ExoSession

Once that is done, you should be able to see a Session and a Module output when you run below

Get-PSSession | where {($_.ComputerName -eq 'outlook.office365.com') -and ($_.ConfigurationName -eq 'Microsoft.Exchange'  )} 
Get-Module | where {$_.Description -like "*outlook.office365.com*" }  | tee-Object -Variable 'exoModule'

And then you should be able to get commands for mailboxes, which will probably be sourced from the module listed above.
Get-Command -Name *mailbox*
If you're not getting any Get-Mailbox* commands from that, see if it even pulled any commands with the module. It could be something like AV is blocking the script.

#After Running the Get-Module command listed a couple code blocks above
$exoModule.ExportedFunctions.Keys + $exoModule.ExportedCommands.Keys  | select -Unique 

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants