You may receive the error “The term Get-MsolUser is not recognized as the name of a cmdlet” when you run the Azure AD powershell command Get-MsolUser to fetch Office 365 users.
The term 'Get-MsolUser' 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:13 + Get-MsolUser <<<< + CategoryInfo : ObjectNotFound: (Get-MsolUser:String) , CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
The cmdlet Get-MsolUser belongs to Azure AD Powershell (V1) module (MSOnline), so before using this command we need to install and connect MSOnline module.
Install MSOnline module:
Earlier you need to download an executable (exe binary) file to install this module, but now Microsoft expired that file and you can install only through powershell. Open Powershell console with Run as administrator privilege and run the following command:
Install-Module MSOnline -Force
Connect/Import MSOnline module:
Once you have installed the MSOnline module, run the following command to connect MSOnline module.
Connect-MsolService # Once you connect MsolService, now run the Get-MsolUser command. Get-MsolUser
The Tech Platform