Office 365 is great, but the Admin Center does not bode well for bulk tasks. What might take an insanely massive amount of time in the graphical user interface may only take seconds in PowerShell.
In the first part of this article, we discuss all the prerequisites required to make the connection. The second part discusses how to make the connection.
First, we need to install the MSOnline module in PowerShell. To do this launch PowerShell as an administrator.
Then type the following:
C:\> Install-Module -Name MSOnline
You may be prompted to install the NuGet provider if it is missing or out of date. Type Y and press enter to install NuGet.
NuGet provider is required to continue
PowerShellGet requires NuGet provider version '18.104.22.168' or newer to interact with NuGet-based repositories. The NuGet provider must be available in 'C:\Program Files\PackageManagement\ProviderAssemblies' or
'C:\Users\Administrator\AppData\Local\PackageManagement\ProviderAssemblies'. You can also install the NuGet provider by running 'Install-PackageProvider -Name NuGet -MinimumVersion 22.214.171.124 -Force'.
Do you want PowerShellGet to install and import the NuGet provider now?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): Y
You may be prompted to allow installation from an untrusted repository. With this being a known module from the PowerShell Gallery, type Y and press enter. However, it is always wise to scrutinize all modules, regardless of where they are sourced.
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
With the module installed you will need to close any PowerShell windows.[Read more…] about Easily Connect to Office 365 with PowerShell