Office 365

Import-PSSession: The runspace state is not valid for this operation

Today after connecting to Office 365 via power shell, I want to get some info on the mailbox, so I tried to run the script Get-Mailbox. But it throws me an error every time I tried to run the command.

GET-MAILBOX: THE TERM ‘GET-MAILBOX’ IS NOT RECOGNIZED AS THE NAME OF A CMDLET

 

get-mailbox-not-recognized-paayi

To solve this upper problem, I researched that we need to run, Import-PSSession command, which provides us with lots of more commands for that particular session. I just typed this command and got this error.

 

import-pssession-error

I researched a lot but found no solution. After 15 mins, my PowerShell connection timeout happened. Then I thought, let’s try one more time, but this time altogether. Below is the whole command what you need to post in your PowerShell window and hit run.

$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri
https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential
-Authentication Basic –AllowRedirection
Import-PSSession $session

 

You will get this result.

Result
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

It means It’s successful. Please leave a comment or ask a question if you need more help.


Restore Quick Parts and AutoText in Outlook 2016

X-OWA-Error: Microsoft.Exchange.Data.Storage

Learn How you can setup Port 8080 on Windows Server

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