As powerful as Office 365 is, it can be made even more powerful with simple PowerShell cmdlets that can streamline your work and make your life easier. In today’s “Deep Dive,” we look at how to use PowerShell to manage Office 365 Exchange Online Services.
Previously in this series, we have explained the PowerShell cmdlets that you can use to manage Windows Azure Active Directory instance of an Office 365 tenant. We explained the use of Get-MsolUser, Get-MsolGroup, Add-MsolGroupMember and Remove-MsolGroupMember PowerShell cmdlets. We also explained how important Get-MsolUser PowerShell cmdlet is when it comes to collecting user information from Office 365 WAAD. Get-MsolUser PowerShell cmdlet plays an important role when collecting information such as Office 365 users licensing information, collecting membership of Office 365 users, and much more. We have provided examples of using Get-MsolUser and other cmdlets in Part 1 through Part 10. You may want to read Part 1 through Part 10 of this article series in case you need to know what Get-MsolUser cmdlet is capable of. (Links to these parts are at the end of this article.)
From this part forward, we are going to explain how you can manage other aspects of an Office 365 tenant using PowerShell. Microsoft provides the necessary PowerShell cmdlets to manage Exchange Online, SharePoint Online, Skype Online, and other services. The key here is that you need to know the PowerShell cmdlets that you can use to interact with Office 365 services. While you might have already worked with some of the Exchange Online PowerShell cmdlets, there are a few hidden PowerShell cmdlets that many Office 365 Admins are not aware of. We will start exploring PowerShell cmdlets available to manage Exchange Online Services and then move on to managing SharePoint and Skype services. In this part, we will provide the necessary steps to get you ready to work with Office 365 Exchange Online Services using PowerShell.
Before you can interact with Office 365 Exchange Online Services, it is important to note that there are a few requirements that you must meet:
Once you have met the above requirements, it is easy as pie to connect to Office 365 Exchange Online. All you need to do is follow the steps outlined below:
$O365Creds = Get-Credential
You will be prompted to enter your Office 365 credential. Enter the Office 365 Exchange Online credential that has Organization Management rights to manage Office 365 Exchange Online Services. Note that by default, only Global Administrator has the necessary permissions to connect to Office 365 Exchange Online Services. In case you are planning to use a different user, make sure to configure the Office 365 user and give him or her appropriate rights to interact with Office 365 Exchange Online Services. To ensure the credential object was created successfully, what you can do is just type the $O365Creds in the PowerShell window. The PowerShell window should list the credential object with the username that you had used.
$Office365Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $O365Creds -Authentication Basic -AllowRedirection
Note that in the above command, we are storing connection information in a variable. We are using the credentials stored in the $O365Creds variable to successfully authenticate against Office 365 Exchange Online.
Import-PSSession $Office365Session -DisableNameChecking
Note that the above command connects to Office 365 Exchange Online Services using the credentials stored in the $O365Creds and also imports the necessary Exchange Online PowerShell modules. As you noticed, we used “-DisableNameChecking” parameter in the above command. When you import a module or cmdlets that have unapproved verbs in their names, the PowerShell window will display a warning. The warning indicates that the some PowerShell commands have unapproved verbs that might make them less predictable. You can safely ignore the warning. All required PowerShell modules to manage Exchange Online will still be imported.
In the next part of this article series, we will continue to focus on Office 365 Exchange Online Services and explain some useful PowerShell cmdlets that will help you interact with Office 365 Exchange Online Services.
If you would like to read the other parts in this article series, here are the links:
Qumulo is an up-and-coming data management solution focusing on managing files in a hybrid setup.…
Is patch management for the Windows PCs at your business driving you crazy? Maybe there's…
Two of the main factors that affect the total cost of an organization’s Microsoft 365…
Samsung rolled out the all-new Galaxy Z Fold 2, Note 20, Note 20 Ultra handsets…
SAN and NAS provide dedicated storage for a group of users using completely different approaches…
In many companies, Generation 1 virtual machines have been superseded by Gen 2 VMs. But…