The error message “A positional parameter cannot be found that accepts argument [user name]” is most likely one of the first errors you’ll encounter when starting up with Office 365 PowerShell’ing:
The fix for this error message is quite simple:
Always use “-UserPrincipalName” as the first argument when running the Get-MSOLUser command:
Alternatively, if you want to search for multiple instances of Azure AD users you can use the SearchString parameter, e.g.:
This command will search the DisplayName or EmailAddress for the provided string.
The PowerShell MSOnline Module
The Get-MSOLUser command is part of the MSOnline PowerShell module.
In many cases you can end up with multiple versions of the MSOnline module installed side by side. Troubleshooting which module is being loaded can be quite confusing.
Also, in some cases, the installation of the module itself causes some headache.
If you want to know more about installation and troubleshooting of this module, have a look at this article. It includes a full explanation of the module load order in PowerShell.
Easy Office 365 Management
To skip the need to use the MSOnline PowerShell module entirely you should have a look at Easy365Manager.
Easy365Manager works as an extension to the familiar AD Users & Computers tool. With Easy365Manager you can configure Office 365 licenses and mailboxes using your native on-premise AD user management tool. No need to constantly log in to the AD Azure portal and Exchange Admin Center.
Easy365Manager also enables you to get rid of your on-premises Exchange Server. This allows you to save a lot of time and money in a short time frame.
Download the free and fully functional 30 day trial here.