get-mailbox : The term ‘get-mailbox’ is not recognized

Get-Mailbox term not recognized

You’re trying to manage Office 365 mailboxes and you receive the below error message:

get-mailbox : The term 'get-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. At line:1 char:1 + get-mailbox + ~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (get-mailbox:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

This error message means that the Exchange Module for PowerShell is not loaded and therefore the command “get-mailbox” is not recognized.

To manage Exchange Online mailboxes in Office 365 with PowerShell you must connect your PowerShell session with Exchange Online. This is done via the following commands:

  1. $Credentials = Get-Credential
  2. $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $Credentials -Authentication Basic -AllowRedirection
  3. Import-PSSession $Session -DisableNameChecking

1. Establish the credentials you will use to connect with Exchange Online.

2. Establish a session with Exchange Online.

3. Import the session into your PowerShell console

The output from the above commands will be similar to this:

ModuleType Version Name ExportedCommands ---------- ------- ---- ---------------- Script 1.0 tmp_ytfbj4ce.guj {Add-AvailabilityAddressSpace, Add-DistributionGroupMember, Add-MailboxFolderPermission, Add-MailboxLocation...}

And this means you’re ready to perform all the magic PowerShell tricks in your Exchange Online environment!

Finally – you may be wondering what commands are available in the Exchange Online module. Use the following command to list all of them (replace the module name with the name you received in the previous output):

PS C:\> (Get-Module -Name tmp_ytfbj4ce.guj).ExportedCommands | ft key Key --- Add-AvailabilityAddressSpace Add-DistributionGroupMember Add-MailboxFolderPermission Add-MailboxLocation Add-MailboxPermission Add-ManagementRoleEntry Add-PublicFolderClientPermission Add-RecipientPermission Add-RoleGroupMember Add-UnifiedGroupLinks Approve-ElevatedAccessRequest Clear-ActiveSyncDevice Clear-MobileDevice Clear-TextMessagingAccount Compare-TextMessagingVerificationCode Complete-MigrationBatch ConvertFrom-ExoJobData.ps1 Delete-QuarantineMessage Deny-ElevatedAccessRequest Disable-AntiPhishRule Disable-App Disable-HostedContentFilterRule Disable-HostedOutboundSpamFilterRule Disable-InboxRule Disable-JournalArchiving Disable-JournalRule Disable-Mailbox Disable-MailPublicFolder Disable-MalwareFilterRule Disable-OutlookProtectionRule Disable-SweepRule Disable-TransportRule Disable-UMAutoAttendant Disable-UMCallAnsweringRule Disable-UMIPGateway Disable-UMMailbox Enable-AntiPhishRule Enable-App Enable-HostedContentFilterRule Enable-HostedOutboundSpamFilterRule Enable-InboxRule Enable-JournalRule Enable-Mailbox Enable-MailPublicFolder Enable-MalwareFilterRule Enable-OrganizationCustomization Enable-OutlookProtectionRule Enable-SweepRule Enable-TransportRule Enable-UMAutoAttendant Enable-UMCallAnsweringRule Enable-UMIPGateway Enable-UMMailbox Export-MailboxDiagnosticLogs Export-MigrationReport Export-QuarantineMessage Export-TransportRuleCollection Export-UMCallDataRecord Export-UMPrompt Get-AcceptedDomain Get-ActiveSyncDevice Get-ActiveSyncDeviceAccessRule Get-ActiveSyncDeviceClass Get-ActiveSyncDeviceStatistics Get-ActiveSyncMailboxPolicy Get-ActiveSyncOrganizationSettings Get-AddressBookPolicy Get-AdminAuditLogConfig Get-AdministrativeUnit Get-AdvancedThreatProtectionDocumentDetail Get-AdvancedThreatProtectionDocumentReport Get-AntiPhishPolicy Get-AntiPhishRule Get-App Get-ApplicationAccessPolicy Get-ATPEvaluation Get-ATPTotalTrafficReport Get-AuditConfig Get-AuditConfigurationPolicy Get-AuditConfigurationRule Get-AuditLogSearch Get-AuthenticationPolicy Get-AuthServer Get-AvailabilityAddressSpace Get-AvailabilityConfig Get-BlockedSenderAddress Get-CalendarDiagnosticAnalysis Get-CalendarDiagnosticLog Get-CalendarDiagnosticObjects Get-CalendarNotification Get-CalendarProcessing Get-CalendarViewDiagnostics Get-CASMailbox Get-CASMailboxPlan Get-ClientAccessRule Get-Clutter Get-CompliancePolicyFileSyncNotification Get-CompliancePolicySyncNotification Get-ComplianceTag Get-ComplianceTagStorage Get-ConnectionByClientTypeDetailReport Get-ConnectionByClientTypeReport Get-ConnectSubscription Get-Contact Get-CsActiveUserReport Get-CsAVConferenceTimeReport Get-CsClientDeviceDetailReport Get-CsClientDeviceReport Get-CsConferenceReport Get-CsP2PAVTimeReport Get-CsP2PSessionReport Get-CsPSTNConferenceTimeReport Get-CsPSTNUsageDetailReport Get-CsUserActivitiesReport Get-CsUsersBlockedReport Get-CustomizedUserSubmission Get-DataEncryptionPolicy Get-DataRetentionReport Get-DeviceComplianceDetailsReport Get-DeviceComplianceDetailsReportFilter Get-DeviceCompliancePolicyInventory Get-DeviceComplianceReportDate Get-DeviceComplianceSummaryReport Get-DeviceComplianceUserInventory Get-DeviceComplianceUserReport Get-DeviceConditionalAccessPolicy Get-DeviceConditionalAccessRule Get-DeviceConfigurationPolicy Get-DeviceConfigurationRule Get-DevicePolicy Get-DeviceTenantPolicy Get-DeviceTenantRule Get-DistributionGroup Get-DistributionGroupMember Get-DkimSigningConfig Get-DlpKeywordDictionary Get-DlpSensitiveInformationTypeConfig Get-DlpSensitiveInformationTypeRulePackage Get-DlpSiDetectionsReport Get-DynamicDistributionGroup Get-ElevatedAccessApprovalPolicy Get-ElevatedAccessAuthorization Get-ElevatedAccessRequest Get-EligibleDistributionGroupForMigration Get-EmailAddressPolicy Get-EvaluationModeReport Get-FailedContentIndexDocuments Get-FederatedOrganizationIdentifier Get-FederationInformation Get-FederationTrust Get-FfoMigrationReport Get-FocusedInbox Get-Group Get-GroupActivityReport Get-GroupMailbox Get-HistoricalSearch Get-HostedConnectionFilterPolicy Get-HostedContentFilterPolicy Get-HostedContentFilterRule Get-HostedOutboundSpamFilterPolicy Get-HostedOutboundSpamFilterRule Get-HotmailSubscription Get-HybridMailflow Get-HybridMailflowDatacenterIPs Get-ImapSubscription Get-InboundConnector Get-InboxRule Get-IntraOrganizationConfiguration Get-IntraOrganizationConnector Get-IRMConfiguration Get-JournalRule Get-LicenseVsUsageSummaryReport Get-LinkedUser Get-LogonStatistics Get-Mailbox Get-MailboxActivityReport Get-MailboxAuditBypassAssociation Get-MailboxAutoReplyConfiguration Get-MailboxCalendarConfiguration Get-MailboxCalendarFolder Get-MailboxFolder Get-MailboxFolderPermission Get-MailboxFolderStatistics Get-MailboxJunkEmailConfiguration Get-MailboxLocation Get-MailboxMessageConfiguration Get-MailboxOverrideConfiguration Get-MailboxPermission Get-MailboxPlan Get-MailboxPreferredLocation Get-MailboxRegionalConfiguration Get-MailboxRestoreRequest Get-MailboxRestoreRequestStatistics Get-MailboxSearch Get-MailboxSpellingConfiguration Get-MailboxStatistics Get-MailboxUsageDetailReport Get-MailboxUsageReport Get-MailboxUserConfiguration Get-MailContact Get-MailDetailATPReport Get-MailDetailEvaluationModeReport Get-MailDetailMalwareReport Get-MailDetailReport Get-MailDetailSpamReport Get-MailDetailTransportRuleReport Get-MailFilterListReport Get-MailFlowStatusReport Get-MailPublicFolder Get-MailTrafficATPReport Get-MailTrafficPolicyReport Get-MailTrafficReport Get-MailTrafficSummaryReport Get-MailTrafficTopReport Get-MailUser Get-MalwareFilterPolicy Get-MalwareFilterRule Get-ManagementRole Get-ManagementRoleAssignment Get-ManagementRoleEntry Get-ManagementScope Get-MessageCategory Get-MessageClassification Get-MessageRecallResult Get-MessageTrace Get-MessageTraceDetail Get-MessageTrackingReport Get-MigrationBatch Get-MigrationConfig Get-MigrationEndpoint Get-MigrationStatistics Get-MigrationUser Get-MigrationUserStatistics Get-MobileDevice Get-MobileDeviceDashboardSummaryReport Get-MobileDeviceMailboxPolicy Get-MobileDeviceStatistics Get-MoveRequest Get-MoveRequestStatistics Get-MxRecordReport Get-MxRecordsReport Get-Notification Get-O365ClientBrowserDetailReport Get-O365ClientBrowserReport Get-O365ClientOSDetailReport Get-O365ClientOSReport Get-OMEConfiguration Get-OnlineMeetingConfiguration Get-OnPremisesOrganization Get-OrganizationalUnit Get-OrganizationConfig Get-OrganizationRelationship Get-OutboundConnector Get-OutboundConnectorReport Get-OutlookProtectionRule Get-OwaMailboxPolicy Get-PartnerApplication Get-PartnerCustomerUserReport Get-PerimeterConfig Get-PerimeterMessageTrace Get-PhishFilterPolicy Get-Place Get-PolicyConfig Get-PopSubscription Get-PublicFolder Get-PublicFolderClientPermission Get-PublicFolderItemStatistics Get-PublicFolderMailboxDiagnostics Get-PublicFolderMailboxMigrationRequest Get-PublicFolderMailboxMigrationRequestStatistics Get-PublicFolderStatistics Get-QuarantineMessage Get-QuarantineMessageHeader Get-RbacDiagnosticInfo Get-Recipient Get-RecipientPermission Get-RecipientStatisticsReport Get-RemoteDomain Get-ReportExecutionInstance Get-ReportSchedule Get-ReportScheduleList Get-ReportSubmissionPolicy Get-ResourceConfig Get-RetentionEvent Get-RetentionPolicy Get-RetentionPolicyTag Get-RMSTemplate Get-RMSTrustedPublishingDomain Get-RoleAssignmentPolicy Get-RoleGroup Get-RoleGroupMember Get-SCInsights Get-ScorecardClientDeviceReport Get-ScorecardClientOSReport Get-ScorecardClientOutlookReport Get-ScorecardMetricsReport Get-SearchDocumentFormat Get-SecurityPrincipal Get-SendAddress Get-SenderPermission Get-SensitivityLabelActivityDetailsReport Get-SensitivityLabelActivityReport Get-ServiceDeliveryReport Get-ServiceStatus Get-SharingPolicy Get-SiteMailbox Get-SiteMailboxDiagnostics Get-SiteMailboxProvisioningPolicy Get-SmimeConfig Get-SPOActiveUserReport Get-SpoofMailReport Get-SPOSkyDriveProDeployedReport Get-SPOSkyDriveProStorageReport Get-SPOTeamSiteDeployedReport Get-SPOTeamSiteStorageReport Get-SPOTenantStorageMetricReport Get-StaleMailboxDetailReport Get-StaleMailboxReport Get-Subscription Get-SupervisoryReviewActivity Get-SupervisoryReviewPolicyReport Get-SupervisoryReviewPolicyV2 Get-SupervisoryReviewReport Get-SupervisoryReviewRule Get-SweepRule Get-SyncConfig Get-SyncRequest Get-SyncRequestStatistics Get-TenantAllowBlockListItems Get-TextMessagingAccount Get-ToolInformation Get-TransportConfig Get-TransportRule Get-TransportRuleAction Get-TransportRulePredicate Get-TxpUserSettings Get-UMAutoAttendant Get-UMCallAnsweringRule Get-UMCallDataRecord Get-UMCallSummaryReport Get-UMDialPlan Get-UMHuntGroup Get-UMIPGateway Get-UMMailbox Get-UMMailboxConfiguration Get-UMMailboxPIN Get-UMMailboxPlan Get-UMMailboxPolicy Get-UMPhoneSession Get-UnifiedAuditSetting Get-UnifiedGroup Get-UnifiedGroupLinks Get-User Get-UserPhoto Import-ContactList Import-RecipientDataProperty Import-RMSTrustedPublishingDomain Import-TransportRuleCollection Import-UMPrompt Invoke-ShadowCalendarSync New-ActiveSyncDeviceAccessRule New-ActiveSyncMailboxPolicy New-AdminAuditLogSearch New-AntiPhishPolicy New-AntiPhishRule New-App New-ApplicationAccessPolicy New-AuthenticationPolicy New-AvailabilityConfig New-ClientAccessRule New-CompliancePolicySyncNotification New-ConnectSubscription New-DistributionGroup New-DkimSigningConfig New-DynamicDistributionGroup New-ElevatedAccessRequest New-EmailAddressPolicy New-HostedConnectionFilterPolicy New-HostedContentFilterPolicy New-HostedContentFilterRule New-HostedOutboundSpamFilterPolicy New-HostedOutboundSpamFilterRule New-InboundConnector New-InboxRule New-IntraOrganizationConnector New-JournalRule New-Mailbox New-MailboxAuditLogSearch New-MailboxFolder New-MailboxRestoreRequest New-MailboxSearch New-MailContact New-MailMessage New-MailUser New-MalwareFilterPolicy New-MalwareFilterRule New-ManagementRole New-ManagementRoleAssignment New-ManagementScope New-MessageClassification New-MigrationBatch New-MigrationEndpoint New-MobileDeviceMailboxPolicy New-MoveRequest New-OnPremisesOrganization New-OrganizationRelationship New-OutboundConnector New-OutlookProtectionRule New-OwaMailboxPolicy New-PartnerApplication New-PrivilegedIdentityManagementRequest New-ProtectionServicePolicy New-PublicFolder New-RemoteDomain New-ReportSchedule New-ReportSubmissionPolicy New-RetentionPolicy New-RetentionPolicyTag New-RoleAssignmentPolicy New-RoleGroup New-SchedulingMailbox New-SharingPolicy New-SiteMailbox New-SiteMailboxProvisioningPolicy New-SweepRule New-SyncMailPublicFolder New-SyncRequest New-TenantAllowBlockListItems New-TransportRule New-UMAutoAttendant New-UMCallAnsweringRule New-UMDialPlan New-UMHuntGroup New-UMMailboxPolicy New-UnifiedGroup Preview-QuarantineMessage Release-QuarantineMessage Remove-ActiveSyncDevice Remove-ActiveSyncDeviceAccessRule Remove-ActiveSyncMailboxPolicy Remove-AntiPhishPolicy Remove-AntiPhishRule Remove-App Remove-ApplicationAccessPolicy Remove-ATPEvaluation Remove-AuditConfigurationPolicy Remove-AuditConfigurationRule Remove-AuditStubFolder Remove-AuthenticationPolicy Remove-AvailabilityAddressSpace Remove-AvailabilityConfig Remove-BlockedSenderAddress Remove-CalendarEvents Remove-ClientAccessRule Remove-CompliancePolicyFileSyncNotification Remove-CompliancePolicySyncNotification Remove-ConnectSubscription Remove-DistributionGroup Remove-DistributionGroupMember Remove-DynamicDistributionGroup Remove-EmailAddressPolicy Remove-HostedConnectionFilterPolicy Remove-HostedContentFilterPolicy Remove-HostedContentFilterRule Remove-HostedOutboundSpamFilterPolicy Remove-HostedOutboundSpamFilterRule Remove-HybridConfiguration Remove-InboundConnector Remove-InboxRule Remove-IntraOrganizationConnector Remove-JournalRule Remove-Mailbox Remove-MailboxFolderPermission Remove-MailboxLocation Remove-MailboxPermission Remove-MailboxRestoreRequest Remove-MailboxSearch Remove-MailboxUserConfiguration Remove-MailContact Remove-MailUser Remove-MalwareFilterPolicy Remove-MalwareFilterRule Remove-ManagementRole Remove-ManagementRoleAssignment Remove-ManagementRoleEntry Remove-ManagementScope Remove-MessageClassification Remove-MigrationBatch Remove-MigrationEndpoint Remove-MigrationUser Remove-MobileDevice Remove-MobileDeviceMailboxPolicy Remove-MoveRequest Remove-OnPremisesOrganization Remove-OrganizationRelationship Remove-OutboundConnector Remove-OutlookProtectionRule Remove-OwaMailboxPolicy Remove-PartnerApplication Remove-PublicFolder Remove-PublicFolderClientPermission Remove-PublicFolderMailboxMigrationRequest Remove-RecipientPermission Remove-RemoteDomain Remove-ReportSchedule Remove-ReportSubmissionPolicy Remove-RetentionPolicy Remove-RetentionPolicyTag Remove-RMSTrustedPublishingDomain Remove-RoleAssignmentPolicy Remove-RoleGroup Remove-RoleGroupMember Remove-SharingPolicy Remove-Subscription Remove-SweepRule Remove-SyncMailPublicFolder Remove-SyncRequest Remove-TenantAllowBlockListItems Remove-TransportRule Remove-UMAutoAttendant Remove-UMCallAnsweringRule Remove-UMDialPlan Remove-UMHuntGroup Remove-UMIPGateway Remove-UMMailboxPolicy Remove-UnifiedGroup Remove-UnifiedGroupLinks Remove-UserPhoto Reset-ShadowCalendar Reset-TxpBlockStatus Resume-MailboxRestoreRequest Resume-MoveRequest Resume-PublicFolderMailboxMigrationRequest Resume-SyncRequest Revoke-ElevatedAccessAuthorization Rotate-DkimSigningConfig Search-AdminAuditLog Search-MailboxAuditLog Search-MessageTrackingReport Search-UnifiedAuditLog Send-TextMessagingVerificationCode Set-AcceptedDomain Set-ActiveSyncDeviceAccessRule Set-ActiveSyncMailboxPolicy Set-ActiveSyncOrganizationSettings Set-AdminAuditLogConfig Set-AntiPhishPolicy Set-AntiPhishRule Set-App Set-ApplicationAccessPolicy Set-AuthenticationPolicy Set-AvailabilityConfig Set-CalendarNotification Set-CalendarProcessing Set-CASMailbox set-CASMailboxPlan Set-ClientAccessRule Set-Clutter Set-ConnectSubscription Set-Contact Set-DataEncryptionPolicy Set-DistributionGroup Set-DkimSigningConfig Set-DynamicDistributionGroup Set-ElevatedAccessRequest Set-EmailAddressPolicy Set-FederatedOrganizationIdentifier Set-FocusedInbox Set-Group Set-GroupMailbox Set-HostedConnectionFilterPolicy Set-HostedContentFilterPolicy Set-HostedContentFilterRule Set-HostedOutboundSpamFilterPolicy Set-HostedOutboundSpamFilterRule Set-HotmailSubscription Set-HybridMailflow Set-ImapSubscription Set-InboundConnector Set-InboxRule Set-IntraOrganizationConnector Set-IRMConfiguration Set-JournalRule Set-LabelProperties Set-LinkedUser Set-Mailbox Set-MailboxAuditBypassAssociation Set-MailboxAutoReplyConfiguration Set-MailboxCalendarConfiguration Set-MailboxCalendarFolder Set-MailboxFolderPermission Set-MailboxJunkEmailConfiguration Set-MailboxLocation Set-MailboxMessageConfiguration Set-MailboxPlan Set-MailboxRegionalConfiguration Set-MailboxRestoreRequest Set-MailboxSearch Set-MailboxSpellingConfiguration Set-MailContact Set-MailPublicFolder Set-MailUser Set-MalwareFilterPolicy Set-MalwareFilterRule Set-ManagementRoleAssignment Set-ManagementRoleEntry Set-ManagementScope Set-MessageClassification Set-MigrationBatch Set-MigrationConfig Set-MigrationEndpoint Set-MigrationUser Set-MobileDeviceMailboxPolicy Set-MoveRequest Set-Notification Set-OMEConfiguration Set-OnPremisesOrganization Set-Organization Set-OrganizationConfig Set-OrganizationRelationship Set-OutboundConnector Set-OutlookProtectionRule Set-OwaMailboxPolicy Set-PartnerApplication Set-PerimeterConfig Set-PhishFilterPolicy Set-Place Set-PopSubscription Set-ProtectionServicePolicy Set-PublicFolder Set-PublicFolderMailboxMigrationRequest Set-RemoteDomain Set-ReportSchedule Set-ReportSubmissionPolicy Set-ResourceConfig Set-RetentionPolicy Set-RetentionPolicyTag Set-RMSTemplate Set-RMSTrustedPublishingDomain Set-RoleAssignmentPolicy Set-RoleGroup Set-SharingPolicy Set-SiteMailbox Set-SiteMailboxProvisioningPolicy Set-SmimeConfig Set-SweepRule Set-SyncRequest Set-TenantAllowBlockListItems Set-TextMessagingAccount Set-TransportConfig Set-TransportRule Set-TxpUserSettings Set-UMAutoAttendant Set-UMCallAnsweringRule Set-UMDialPlan Set-UMIPGateway Set-UMMailbox Set-UMMailboxConfiguration Set-UMMailboxPIN Set-UMMailboxPolicy Set-UnifiedAuditSetting Set-UnifiedGroup Set-User Set-UserPhoto Start-AuditAssistant Start-HistoricalSearch Start-ManagedFolderAssistant Start-MigrationBatch Start-MigrationUser Start-UMPhoneSession Stop-HistoricalSearch Stop-MigrationBatch Stop-MigrationUser Stop-UMPhoneSession Suspend-MailboxRestoreRequest Suspend-MoveRequest Suspend-PublicFolderMailboxMigrationRequest Suspend-SyncRequest Test-ApplicationAccessPolicy Test-ClientAccessRule Test-DataEncryptionPolicy Test-InformationBarrierPolicy Test-IRMConfiguration Test-MAPIConnectivity Test-MigrationServerAvailability Test-OAuthConnectivity Test-OrganizationRelationship Test-SiteMailbox Troubleshoot-AgendaMail Undo-SoftDeletedMailbox Undo-SoftDeletedUnifiedGroup Update-DistributionGroupMember Update-HybridConfiguration Update-PublicFolderMailbox Update-Recipient Update-RoleGroupMember Update-SiteMailbox Upgrade-DistributionGroup Validate-OutboundConnector Validate-RetentionRuleQuery Validate-ShadowCalendar Write-AdminAuditLog

Summary

If you want more information on how to connect with PowerShell to the various Office 365 modules have a look at this article.

To skip PowerShell altogether and manage Office 365 mailboxes using the native AD Users & Computers management tool check out Easy365Manager.

Did you like this post? Maybe your friends will too!