Get-msoluser :The socket connection was aborted

Frequent Contributor

When i run following command in powershell 

get-msoluser -MaxResults 10000 |select displayname |Measure-Object"


i got following issue 


The socket connection was aborted. This could be caused by an error processing

your message or a receive timeout being exceeded by the remote host, or an underlying network

resource issue. Local socket timeout was '00:00:59.9220000'.

At line:1 char:1

+ get-msoluser -MaxResults 10000 |select displayname |Measure-Object

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : OperationStopped: (:) [Get-MsolUser], CommunicationException

    + FullyQualifiedErrorId : System.ServiceModel.CommunicationException,Microsoft.Online.Admin



can anyone help me to overcome this problem

1 Reply

Some things to consider:

  1. Are you running through proxy - this can lead to some timeout issues
  2. Ensure you are running the latest Microsoft Azure Active Directory Module for Windows PowerShell
  3. Move to the newer Azure Active Directory V2 PowerShell module instead of this module

If you choose option 3, the equivlant starting point would be:

Get-AzureADUser -top 10000 | select displayname | measure-object


Or get ALL:

 Get-AzureADUser -all $true | select displayname | measure-object