I found this great TechNet article and wanted to share:
Connect to all Office 365 services in a single Windows PowerShell window
It’s a greatly described article about how to connect to each Office 365 service – MSOL itself, Exchange Online, Skype For Business, SharePoint Online and the Compliance Center.
If you go through the article, you can set up a script to prompt you once for Office 365 administrator credentials, and connect to each service for a one stop shop on managing your Office 365 environment from PowerShell.
One catch (which is mentioned in the article) is that you’ll need to run PowerShell in Administrator mode, or you won’t be able to import modules. You’ll see an error like:
The specified module 'Microsoft.Online.SharePoint.Online.PowerShell' was not loaded because no valid module file was found in any directory.
If you aren’t sure if you’re in Administrator or User mode, the default path prompted in the PowerShell window will be “PS C:\users\username>” for User mode, and “PS C:\Windows\system32>” for Administrator mode (along with the word “Administrator” in the PowerShell window title.
I’m only new to Office 365, but I’ve found the GUI via the web for user management rather basic – I can’t do simple tasks such as search for users on a specific domain, then add them to a group. PowerShell is absolutely necessary if you want to manage Office 365.
3 thoughts on “Connect to all Office 365 services via PowerShell”
>PowerShell is absolutely necessary if you want to manage Office 365
That’s not exactly true. There are other ways to gain control over Office 365 in one place. There is a tool called Adaxes (http://www.adaxes.com/) that provides you with a control point for O365 as well as AD, Exchange, etc. There are two things that are particularly cool about it. First, you can create different WebUIs for different user types, so, say, admins have a full control panel, helpdesks can reset passwords, users can search and do self-service — all that from the browser. Second, it also provides you automation capabilities, so you can automatically assign and revoke licences, update accounts based on some predefined rules and so on. If you are exploring ways to work with Office 365 in a better way, that’s worth having a look.
Can you do what my example says, and search for users by a domain and mass add them to a group?
Yes. You can also do that via Web GUI (not the Office365 one, but Adaxes WebUI). You can customize it to perform search or any other operation. You can also create custom actions that can be very complicated (multistep, involving scripts, etc.) but for the end user they will be just one button actions in the browser.
You can also add automation steps. Say, once you add users to a specific group you would like to give them a specific license in Office 365. And this can just happen once you setup the rule.