You’re trying to manage Office 365 users with PowerShell and get this error:
Get-MsolUser : 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:1 + Get-MsolUser + ~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Get-MsolUser:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
This error is caused by the MSOnline Module for PowerShell not being loaded, and therefore the command “Get-MsolUser” is not recognized.
(PowerShell 3.0 and later versions will autoload the necessary module, so the problem is likely that the MSOnline module is missing from your system.)
To fix this problem, install the MSOnline module by running the following command:
Install-Module MSOnline
(make sure to run it as Administrator – read more about PowerShell module load order and advanced troubleshooting here)
After running this command, you may receive the following message:
Untrusted repository You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from 'PSGallery'? [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): Y
Type Y and press enter to have the module downloaded and installed.
You can then connect to your tenant and start managing your Azure AD user accounts:
PS C:\> Connect-MsolService PS C:\> Get-MsolUser -UserPrincipalName hans.c.orsted@azure.skrubbeltrang.com UserPrincipalName DisplayName isLicensed ----------------- ----------- ---------- hans.c.orsted@azure.skrubbeltrang.com Hans Christian Ørsted True
Manage Office 365 Users and Licenses Without PowerShell
If you’re looking for a faster and more efficient way to manage your Office 365 users, licenses, and mailboxes, you should have a look at Easy365Manager.
With Easy365Manager, you can directly manage Office 365 users and mailboxes in the Active Directory Users & Computers management console.
Easy365Manager is a snap-in that extends the user and group properties in AD Users & Computers.
As seen here, with Easy365Manager, you have direct and easy access to configure the Office 365 licenses of your AD users from the familiar Active Directory admin tool:
MSOnline Module PowerShell Commands
If you want to know what commands are available in the MSOnline PowerShell module, use the following command.
PS C:\> (Get-Module -Name MSOnline).ExportedCommands | ft key Key --- Add-MsolAdministrativeUnitMember Add-MsolForeignGroupToRole Add-MsolGroupMember Add-MsolRoleMember Add-MsolScopedRoleMember Confirm-MsolDomain Confirm-MsolEmailVerifiedDomain Connect-MsolService Convert-MsolDomainToFederated Convert-MsolDomainToStandard Convert-MsolFederatedUser Disable-MsolDevice Enable-MsolDevice Get-MsolAccountSku Get-MsolAdministrativeUnit Get-MsolAdministrativeUnitMember Get-MsolCompanyAllowedDataLocation Get-MsolCompanyInformation Get-MsolContact Get-MsolDevice Get-MsolDeviceRegistrationServicePolicy Get-MsolDirSyncConfiguration Get-MsolDirSyncFeatures Get-MsolDirSyncProvisioningError Get-MsolDomain Get-MsolDomainFederationSettings Get-MsolDomainVerificationDns Get-MsolFederationProperty Get-MsolGroup Get-MsolGroupMember Get-MsolHasObjectsWithDirSyncProvisioningErrors Get-MsolPartnerContract Get-MsolPartnerInformation Get-MsolPasswordPolicy Get-MsolRole Get-MsolRoleMember Get-MsolScopedRoleMember Get-MsolServicePrincipal Get-MsolServicePrincipalCredential Get-MsolSubscription Get-MsolUser Get-MsolUserByStrongAuthentication Get-MsolUserRole New-MsolAdministrativeUnit New-MsolDomain New-MsolFederatedDomain New-MsolGroup New-MsolLicenseOptions New-MsolServicePrincipal New-MsolServicePrincipalAddresses New-MsolServicePrincipalCredential New-MsolUser New-MsolWellKnownGroup Redo-MsolProvisionContact Redo-MsolProvisionGroup Redo-MsolProvisionUser Remove-MsolAdministrativeUnit Remove-MsolAdministrativeUnitMember Remove-MsolApplicationPassword Remove-MsolContact Remove-MsolDevice Remove-MsolDomain Remove-MsolFederatedDomain Remove-MsolForeignGroupFromRole Remove-MsolGroup Remove-MsolGroupMember Remove-MsolRoleMember Remove-MsolScopedRoleMember Remove-MsolServicePrincipal Remove-MsolServicePrincipalCredential Remove-MsolUser Reset-MsolStrongAuthenticationMethodByUpn Restore-MsolUser Set-MsolADFSContext Set-MsolAdministrativeUnit Set-MsolCompanyAllowedDataLocation Set-MsolCompanyContactInformation Set-MsolCompanyMultiNationalEnabled Set-MsolCompanySecurityComplianceContactInformation Set-MsolCompanySettings Set-MsolDeviceRegistrationServicePolicy Set-MsolDirSyncConfiguration Set-MsolDirSyncEnabled Set-MsolDirSyncFeature Set-MsolDomain Set-MsolDomainAuthentication Set-MsolDomainFederationSettings Set-MsolGroup Set-MsolPartnerInformation Set-MsolPasswordPolicy Set-MsolServicePrincipal Set-MsolUser Set-MsolUserLicense Set-MsolUserPassword Set-MsolUserPrincipalName Update-MsolFederatedDomain