Office 365

Get-mailbox : The term ‘get-mailbox’ is not recognized as the name of a cmdlet

After connecting to Office 365 from PowerShell, I want to check the information or size of a particular mailbox. So I just ran a command

Get-mailbox – id “paayi-e1”

The moment I hit enter it throws me an error as shown below.

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



get-mailbox not recognized 


I need to figure out why this issue is coming, so I looked on the internet and found out that we need to import PSSession.

This Import-PSSession cmdlet imports many commands, functions & aliases. Import-PSSession import all the commands excepts those who have same names as the command in the current session. If you still want to import every command then please use the AllowClobber parameter.

You can use any of the Imported commands just you would use regular commands in this particular session. Only one thing keep in mind that you must keep your connection open for this particular session. If you close the session or timeout then all imported commands are no longer run.



Please run this command

Import-PSSession $session

PS C:WINDOWSsystem32> $UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange 
-Credential $UserCredential -Authentication Basic –AllowRedirection
Import-PSSession $session


cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
WARNING: The names of some imported commands from the module 
'tmp_zdv2hsce.qkw' include unapproved verbs that
might make them less discoverable. To find the commands with unapproved verbs, 
run the Import-Module command
again with the Verbose parameter. For a list of approved verbs, type Get-Verb.

ModuleType Version Name ExportedCommands 
---------- ------- ---- ---------------- 
Script 1.0 tmp_zdv2hsce.qkw {Add-AvailabilityAddressSpace, Add-Distribution...



ran import-pssession command


Now when we try to check or run get-mailbox It will come in Powershell Intellisense


get-mailbox is coming now



We tested the get-mailbox script to check the information on the group mailbox and we get this result.

Get-Mailbox -GroupMailbox “Group Name”


get-mailox- groupmailbox test