---
title: "Prerequisites for managing Microsoft 365 using PowerShell"
canonical: "https://docs.cuesystem.com/space/Dep/153190417/Prerequisites%20for%20managing%20Microsoft%20365%20using%20PowerShell"
format: markdown
---
A lot of settings, especially bulk, are effective to do using the PowerShell command line.

To manage Microsoft 365, you must install the necessary modules on your computer before using PowerShell for the first time. Start PowerShell as an administrator (on a Windows 10 computer, for example, right-click the Start button and select the appropriate option) and type the following commands:

- *Install-Module MSOnline*
- *Install-Module AzureAD*
- *Install-Module ExchangeOnlineManagement*  
After each command, enable the installation of the given module.

You now have the necessary modules installed in PowerShell on your computer. Before you can run Microsoft 365 setup commands, you must first log in with an administrator account. To do this, use the command:

- *Connect-ExchangeOnline -UserPrincipalName < ADMINMAILBOX > -ShowProgress $true*
- Example: *Connect-ExchangeOnline -UserPrincipalName **[admin@contoso.com](mailto:admin@contoso.com)** -ShowProgress $true*  
You will now be prompted to enter the administrator password. After entering it, you are logged in and can run the necessary commands.

After setting all the necessary things, use the following command to finish:

- *exit*