PowerShell это основное средство администрирования как on-premises организаций Exchange Server, так и облачного Exchange Online в Microsoft 365. В этой статье мы покажем, как установить PowerShell модуль Exchange Online PowerShell v2 (EXO V2) в Windows, как подключиться к вашем тенанту Exchange Online и управлять ящиками и другими почтовыми объектами в Micrtosoft 365.
Обратите внимание, что сейчас одновременно существуют два модуля для управления Exchange Online: Exchange Online PowerShell v1 и современный Exchange Online PowerShell v2 (EXO v2). Если нет четких оснований использовать старый модуль (legacy скрипты и т.д.), старайтесь всегда использовать EXO v2: он работает быстрее (как и новый модуль Azure AD, он основан на REST API в реализации Microsoft Graph), командлеты оптимизированы для обработки множества объектов, вместо Basic используется Modern аутентификация, поддерживается MFA аутентификация, версии ExchangeOnlineManagement 2.0.4 и выше работают в версиях PowerShell Core 6.x, 7x и macOS, Ubintu 18.04/20.04.
Установка модуля Exchange Online PowerShell V2 (EXO V2))
Для установки модуля Exchange Online PowerShell в Windows нужна версия PowerShell 5.x (PowerShell Core поддерживается, начиная с версии модуля ExchangeOnlineManagement 2.0.4).
Настройки политики запуска скриптов PowerShell на компьютере должны разрешать запуск локальных PS файлов:
Set-ExecutionPolicy RemoteSigned
Установите и обновите модуль PowershellGet:
Install-Module PowershellGet -Force
Update-Module PowershellGet
Для установки модуля EXOv2 (ExchangeOnlineManagement) из галереи скриптов PowerShell для всех пользователей компьютера, выполните:
Install-Module -Name ExchangeOnlineManagement -Force -Scope AllUsers
Теперь модуль можно импортировать в сессию:
Import-Module ExchangeOnlineManagement
Проверьте, что модуль установлен. Также отображается его версия (2.0.5 в моем случае):
Get-Module ExchangeOnlineManagement
В скриптах можно проверять наличие модуля такой командой:
(Get-Module -ListAvailable -Name ExchangeOnlineManagement) -ne $null
Для обновления модуля EXOv2 используйте команду:
Update-Module ExchangeOnlineManagement
Подключение к Exchange Online с помощью PowerShell
Для подключения к вашему тенанту Microsoft 365 с помощью модуля Exchange Online, исопльзуется командлет Connect-ExchangeOnline. Например, можно указать UPN пользователя с правами глобального администратора тенанта:
Connect-ExchangeOnline -UserPrincipalName [email protected] -ShowProgress $true
Укажите пароль пользователя и подтвердите вход через MFA (удобнее всего использовать приложение Microsoft Authenticator на смартфоне).
Если на компьютере не установлен браузер (например, вы подключаетесь к Exchange Online из Linux или Windows Server Core), сформировать строку и код для авторизации в PowerShell Core 7.x можно так:
Connect-ExchangeOnline -Device
Сформированный URL и код нужно использовать для аутентификации на другом компьютере с браузером.
Или используйте параметр –InlineCredential для интерактивного ввода пароля в консоли.
Если у вашего аккаунта есть доступ к нескольким тенантам Azure, можно указать имя с помощью параметра DelegatedOrganization:
Connect-ExchangeOnline -UserPrincipalName [email protected] -ShowProgress $true -DelegatedOrganization winitprotest2.onmicrosoft.com
Если для аккаунта отключен Modern Authentication, можно подключится так:
$cred = Get-Credential
Connect-ExchangeOnline -Credential $cred -UserPrincipalName [email protected] -ShowProgress $true
Вы можете проверить, что в системе есть активное подключение к Exchange Online так:
Get-PSSession| ft –AutoSize
В нашем примере подключение к outlook.office365.com активно (State=Opened)
После завершения работы с Exchange Online не забывайте корректно закрывать свою сессию с помощью командлета Disconnect-ExchangeOnline. Дело в том, что Exchange Online поддерживает максимум 5 одновременных PowerShell сессий. Если вы попробуете открыть шестую сессию, появится ошибка:
Fail to create a runspace because you have exceeded the maximum number of connections allowed.
Следующий код можно использовать в ваших PowerShell скриптах для проверки, что подключение к Exchange Online через модуль EXOv2 уже активно. Это позволит избежать создания лишних удаленных PowerShell сессий к Microsoft 365.
$psSessions = Get-PSSession | Select-Object -Property State, Name
If (((@($psSessions) -like '@{State=Opened; Name=ExchangeOnlineInternalSession*').Count -gt 0) -ne $true) {
Connect-ExchangeOnline -UserPrincipalName [email protected] }
Управление Exchange Online с помощью командлетов модуля ExchangeOnlineManagement
Список доступных командлетов в модуле EXO v2 можно вывести командой:
Get-Command -Module ExchangeOnlineManagement
На данный момент доступно 23 командлета:
- Connect-ExchangeOnline
- Connect-IPPSSession
- Disconnect-ExchangeOnline
- Get-WrappedCommand
- IsCloudShellEnvironment
- UpdateImplicitRemotingHandler
- Get-EXOCasMailbox
- Get-EXOMailbox
- Get-EXOMailboxFolderPermission
- Get-EXOMailboxFolderStatistics
- Get-EXOMailboxPermission
- Get-EXOMailboxStatistics
- Get-EXOMobileDeviceStatistics
- Get-EXORecipient
- Get-EXORecipientPermission
- Get-MyAnalyticsFeatureConfig
- Get-OwnerlessGroupPolicy
- Get-UserBriefingConfig
- Get-VivaInsightsSettings
- Set-MyAnalyticsFeatureConfig
- Set-OwnerlessGroupPolicy
- Set-UserBriefingConfig
- Set-VivaInsightsSettings
Обратите внимание, что названия некоторых команндлетов в модуле Exchange Online изменились. У большинства из них появился суффикс EXO. Например, вместо Get-Mailbox нужно использовать
Get-EXOMailbox
, вместо Get-MailboxPermission —
Get-EXOMailboxPermission
и т.д. Поэтому, если у вас остались скрипты для EXOv1, придется внимательно их переписать под EXOv2.
Можно вывести список ящиков в вашем тенанте Exchange или информацию о конкретном ящике:
Get-EXOMailbox |ft
Get-EXOMailbox kbuldogov
Вывести пользователей, у которых разрешен POP и IMAP доступ:
Get-EXOCasMailbox -PropertySets Imap,pop
Вывести размер всех ящиков:
Get-EXOMailbox | Get-EXOMailboxStatistics
Размеры всех общих ящиков:
Get-EXOMailbox | Where-Object{$_.RecipientTypeDetails -eq "SharedMailbox"} | Get-EXOMailboxStatistics
Обратите внимание, что в модуле ExchangeOnlineManagement нет, например, командлета Set-Mailbox. Дело в том, что остальные доступные командлеты Exchange Online (более 750) импортируются в вашу PowerShell сессию после подключения к тенанту. Сначала вам нужно получить имя сессии:
Get-PSSession| select ConfigurationName,CurrentModuleName
По сгенерированному имени сессии можно получить список доступных командлетов:
Get-Command -Module tmp_4mpa2wak.dga
Т.е. чтобы изменить SMTP адрес пользователя, можно использовать команду:
Get-EXOMailbox kbuldogov | Set-Mailbox -EmailAddresses @{Add='kbuldogov2 @winitpro.ru'}
In Exchange Server, we can load Exchange Management Shell module in Windows PowerShell ISE. This way, we can run Exchange cmdlets in PowerShell ISE just like we are used to in Exchange Management Shell. But, is there another way to connect to Exchange Server with PowerShell? This article will teach you how to load Exchange Management Shell snapin in PowerShell ISE.
Table of contents
- Information
- Error when running Exchange cmdlet in PowerShell ISE
- Import Exchange Management Module in PowerShell ISE
- Add Exchange Management snapin Exchange 2010
- Add Exchange Management snapin Exchange 2013/2016/2019
- Without Exchange Management Tools installed
- Connect to Exchange Servers with remote PowerShell
- 1. Enter the credentials
- 2. Provide required connection settings
- 3. Import Exchange cmdlets
- Verify it’s working
- Conclusion
Information
Microsoft PowerShell ISE stands for Integrated Scripting Environment. Why do we like to use Windows PowerShell ISE if it comes to running scripts or cmdlets?
- Works more comfortable with the editor
- It shows you the cmdlets as you type
- Better interface (GUI)
Error when running Exchange cmdlet in PowerShell ISE
If you run an Exchange cmdlet in PowerShell ISE, you will get an error. Let’s use the Get-Mailbox cmdlet.
Get-Mailbox
The output shows the error below.
Get-Mailbox : The term 'Get-Mailbox' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Get-Mailbox
+ ~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-Mailbox:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
You did get this error because you don’t have Exchange Management Module imported in Windows PowerShell ISE.
Import Exchange Management Module in PowerShell ISE
We want to import the Exchange module in PowerShell ISE on the Exchange Server. We also like to do the same on another server with Exchange Management Tools installed.
To load Exchange snapin in PowerShell ISE, you can run the following cmdlets. After that, run the Get-Mailbox cmdlet to verify that it’s working.
Add Exchange Management snapin Exchange 2010
Run PowerShell ISE as administrator. Add the Microsoft Exchange Management snapin.
Add-PSsnapin Microsoft.Exchange.Management.PowerShell.E2010
Add Exchange Management snapin Exchange 2013/2016/2019
Run PowerShell ISE as administrator. Add the Microsoft Exchange Management snapin.
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn
We have a management server, and we want to connect to the Exchange Server with PowerShell ISE. If you open it on another server without Exchange Management Tools installed, it will not work.
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn
You get the error below because you have to install Exchange Management Tools. After that, run the snapin cmdlet to import Exchange Management Tools.
Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 5.
At line:1 char:1
+ Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn;
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (Microsoft.Excha...werShell.SnapIn:String) [Add-PSSnapin], PSArgumentException
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand
Connect to Exchange Servers with remote PowerShell
The above Exchange snapin cmdlets will work fine. Is there another way to load the Exchange module in PowerShell? Yes, there is.
In three steps, we can create a remote PowerShell connection to Exchange Server:
- Enter credentials
- Provide required connection settings
- Import Exchange cmdlets
You can connect from Exchange Server itself or another server. For example, a Management Server. The good thing is that you can run this without installing Exchange Management Shell on the remote server. But, some cmdlets will not give you the correct output. For example, the Get-ExchangeCertificate cmdlet will not give you all the properties.
Note: We do recommend to install the Exchange Management Tools on any server to administer Exchange Servers.
Run PowerShell ISE as administrator and run Get-ExecutionPolicy cmdlet to check if it’s correctly set.
Get-ExecutionPolicy
If it’s not set as RemoteSigned, run the command below.
Set-ExecutionPolicy RemoteSigned
1. Enter the credentials
Run the command below.
$UserCredential = Get-Credential
A prompt will show. Fill in the account UPN with admin privileges.
2. Provide required connection settings
Replace EX01-2016.exoip.local to your Exchange server FQDN. The connectionUri is http and not https.
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://EX01-2016.exoip.local/PowerShell/ -Authentication Kerberos -Credential $UserCredential
3. Import Exchange cmdlets
Import the Exchange cmdlets in the Windows PowerShell session so you can administer Exchange.
Import-PSSession $Session -DisableNameChecking
If you get errors when connecting to the PowerShell virtual directory, read Recreate virtual directories in Exchange Server.
Verify it’s working
Run the Get-Mailbox cmdlet and see the results.
Get-Mailbox
If you are finished with your work, don’t forget to sign off.
Remove-PSSession $Session
You did connect to Exchange Server from another server or from Exchange server itself. This time with remote PowerShell. Did this load Exchange cmdlets in PowerShell ISE for you?
Read more: Install Exchange Online PowerShell module »
Conclusion
You learned how to load Exchange Management Shell in PowerShell ISE. The next time you connect to the Exchange Server, you can connect with remote PowerShell and not load the Exchange snapin. Both ways will work.
It’s best to Install Exchange Management Tools on any server to administer Exchange Servers. After that, import the Exchange snapin in PowerShell ISE. This way, all the Exchange cmdlets are available.
Did you enjoy this article? You may also like Install Exchange Cumulative Update. Don’t forget to follow us and share this article.
Ready to supercharge your Exchange management? Learn to install Exchange Online PowerShell v2 module and take control of your environment.
Are you an IT professional looking to streamline your Exchange Online management tasks? Look no further! In this comprehensive guide, we’ll walk you through the process of installing and using the Exchange Online PowerShell v2 module. This powerful tool will revolutionize the way you interact with Exchange Online, making your job easier and more efficient.
In today’s fast-paced IT world, managing Exchange Online environments efficiently is crucial. The Exchange Online PowerShell v2 module is a game-changer, offering improved performance, enhanced security, and a more user-friendly experience. Whether you’re a seasoned Exchange administrator or just starting your journey, this guide will equip you with the knowledge to harness the full potential of this essential tool.
What is the Exchange Online PowerShell v2 Module?
The Exchange Online PowerShell v2 module, often referred to as the EXO V2 module, is a powerful set of cmdlets designed to manage Exchange Online environments. It’s the next evolution of Exchange Online management, offering significant improvements over its predecessor.
Why Upgrade to the v2 Module?
Upgrading to the Exchange Online PowerShell v2 module brings several benefits:
- Improved Performance: The v2 module is optimized for bulk operations, making it significantly faster than the previous version.
- Enhanced Security: It supports modern authentication methods, including multi-factor authentication (MFA).
- Cross-Platform Compatibility: Works with Windows PowerShell 5.1 and PowerShell 7 on Windows, Linux, and macOS.
- Simplified Cmdlet Structure: Introduces new, more intuitive cmdlets for common operations.
Prerequisites for Installation
Before you install Exchange Online PowerShell v2 module, ensure your system meets the following requirements:
- Windows PowerShell 5.1 or PowerShell 7.0.3 or later
- .NET Framework 4.5 or later
- Windows Management Framework 5.1 (for Windows PowerShell 5.1)
Supported Operating Systems
- Windows 10
- Windows Server 2019
- Windows Server 2016
- Windows 8.1
- Windows Server 2012 R2
- Linux (with PowerShell 7)
- macOS (with PowerShell 7)
How to Check PowerShell Version in Windows 10
To check your PowerShell version, follow these steps:
- Open PowerShell
- Run one of the following commands:
- $PSVersionTable.PSVersion
Get-Host | Select-Object Version
How to Install Exchange Online PowerShell v2 Module
Now that you’ve confirmed your system meets the prerequisites, let’s walk through the installation process:
Step 1: Install or Update PowerShellGet
First, ensure you have the latest version of PowerShellGet:
Install-Module -Name PowerShellGet -Force -AllowClobber
Step 2: Close and Reopen PowerShell
After updating PowerShellGet, close your PowerShell window and open a new one to ensure the changes take effect.
Step 3: Install the EXO V2 Module
Now, you’re ready to install the Exchange Online PowerShell v2 module. You have two options:
Option A: Install for All Users (requires admin privileges)
Install-Module -Name ExchangeOnlineManagement
Option B: Install for Current User Only
Install-Module -Name ExchangeOnlineManagement -Scope CurrentUser
If prompted about installing from an untrusted repository, type Y
and press Enter to continue.
Step 4: Import the Module
After installation, import the module:
Import-Module ExchangeOnlineManagement
Verifying the Installation
To confirm that the Exchange Online PowerShell v2 module has been installed successfully, run:
Get-Module ExchangeOnlineManagement -ListAvailable | Select-Object Name,Version,Path
This command will display the module’s name, version, and installation path.
Connecting to Exchange Online with the v2 Module
Now that you’ve installed the Exchange Online PowerShell v2 module, let’s connect to your Exchange Online environment:
Connect-ExchangeOnline -UserPrincipalName your_email @ domain.com
If you’re using multi-factor authentication (MFA), the module will automatically prompt you for additional verification.
Key Features and Cmdlets
The EXO V2 module introduces several new cmdlets that offer improved performance and functionality. Here are some key cmdlets you should know:
Get-EXOMailbox
: Retrieves mailbox informationGet-EXOCASMailbox
: Gets Client Access settings for mailboxesGet-EXORecipient
: Retrieves recipient informationGet-EXOMailboxPermission
: Gets mailbox permissionsGet-EXOMailboxStatistics
: Retrieves mailbox statistics
These cmdlets are optimized for bulk operations and offer significant performance improvements over their traditional counterparts.
Troubleshooting Common Installation Issues
Issue 1: Module Not Found
If you encounter the error “The specified module ‘ExchangeOnlineManagement’ was not loaded because no valid module file was found in any module directory,” try the following:
- Ensure you’re running PowerShell as an administrator
- Check your internet connection
- Try installing the module for the current user only:
Install-Module -Name ExchangeOnlineManagement -Scope CurrentUser -Force
Issue 2: Execution Policy Restrictions
If you receive an error related to execution policy, you may need to adjust your PowerShell execution policy:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Issue 3: TLS 1.2 Not Enabled
If you’re having trouble connecting to the PowerShell Gallery, ensure TLS 1.2 is enabled:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Updating the EXO V2 Module
To keep your Exchange Online PowerShell v2 module up to date, periodically run:
Update-Module -Name ExchangeOnlineManagement
This command will check for and install any available updates.
Uninstalling the EXO V2 Module
If you need to uninstall the Exchange Online PowerShell v2 module, use the following command:
Uninstall-Module -Name ExchangeOnlineManagement
Best Practices for Using the EXO V2 Module
- Use Property Sets: Utilize the PropertySets parameter to retrieve only the properties you need, improving command performance.
- Leverage Paging: For large datasets, use the ResultSize parameter to control the number of results returned.
- Implement Error Handling: Use try-catch blocks to handle potential errors gracefully.
- Use the Latest Version: Regularly update the module to benefit from the latest features and bug fixes.
- Disconnect When Done: Always use the
Disconnect-ExchangeOnline
cmdlet when you’re finished to close the connection securely.
Key Takeaways
- The Exchange Online PowerShell v2 module offers significant performance improvements and enhanced security features.
- Installation is straightforward, requiring only a few PowerShell commands.
- New cmdlets like Get-EXOMailbox and Get-EXORecipient provide optimized performance for bulk operations.
- Regular updates ensure you have access to the latest features and improvements.
- Proper error handling and efficient use of property sets can greatly enhance your scripting experience.
FAQ
- Q: Can I use the EXO V2 module with PowerShell 7? A: Yes, the Exchange Online PowerShell v2 module is compatible with PowerShell 7 on Windows, Linux, and macOS.
- Q: Do I need to uninstall the older Exchange Online module before installing v2? A: No, you can have both modules installed side by side. However, it’s recommended to use the v2 module for better performance.
- Q: How do I check which version of the EXO V2 module I have installed? A: Run the command
Get-Module ExchangeOnlineManagement -ListAvailable | Select-Object Name,Version
- Q: Can I use the EXO V2 module to manage on-premises Exchange servers? A: No, the EXO V2 module is designed specifically for Exchange Online management.
- Q: Is multi-factor authentication (MFA) supported with the EXO V2 module? A: Yes, the module fully supports MFA and modern authentication methods.
- Q: How do I update the EXO V2 module to the latest version? A: Use the command
Update-Module -Name ExchangeOnlineManagement
- Q: Can I use the EXO V2 module in scripts? A: Absolutely! The module is designed to work well in both interactive sessions and scripts.
- Q: Are there any limitations to using the EXO V2 module? A: While the module offers many improvements, some legacy cmdlets may not be available. Always check the documentation for the most up-to-date information.
- Q: How do I get help with specific cmdlets in the EXO V2 module? A: Use the
Get-Help
cmdlet followed by the cmdlet name, e.g.,Get-Help Get-EXOMailbox
- Q: Can I use the EXO V2 module to manage Exchange Online Protection (EOP) and Security & Compliance Center? A: Yes, the module provides cmdlets for managing EOP and Security & Compliance features.
By following this comprehensive guide, you should now be well-equipped to install, use, and maintain the Exchange Online PowerShell v2 module. This powerful tool will undoubtedly enhance your Exchange Online management capabilities, making your IT tasks more efficient and effective. Happy scripting!
Related Articles:
- Microsoft 365 Business Basic vs Standard
Further Reading:
- about the Exchange Online PowerShell v2 module Microsoft docs
To install the Exchange Online PowerShell module, use the command below in your PowerShell prompt:
Install-Module -Name ExchangeOnlineManagement
Prerequisites
Understanding PowerShell Versions
Before diving into the installation process, it’s essential to understand which versions of PowerShell are compatible with the Exchange Online PowerShell module. Microsoft generally recommends using Windows PowerShell 5.1 or PowerShell Core 7 and above. Upgrading to the latest version not only enhances security but also optimizes performance, providing you with better command execution capabilities.
Required Access Permissions
To successfully install the Exchange Online PowerShell module, you need to have certain permissions. It’s crucial to have permissions akin to an Azure AD Administrator or similar roles that allow you to install components from the PowerShell Gallery. This ensures you can execute the necessary commands without encountering access issues.
Update Exchange Online PowerShell Module: A Quick Guide
Installing the Exchange Online PowerShell Module
Accessing Windows PowerShell
To get started, you need to launch PowerShell on your system. This can be done in different ways depending on your Windows version. Once open, it’s a good practice to check your PowerShell version to confirm compatibility:
$PSVersionTable.PSVersion
This command outputs the version number, ensuring you have the correct setup for the installation.
Running the Installation Command
Once you have verified compatibility, you can initiate the installation of the Exchange Online PowerShell module. Simply execute the following command in your PowerShell window:
Install-Module -Name ExchangeOnlineManagement
This command pulls the ExchangeOnlineManagement module from the PowerShell Gallery and installs it on your local machine. It’s straightforward, but it’s important to understand what this command does—Install-Module is the cmdlet that lets you get modules from online repositories, and -Name specifies the module you want to install.
Handling Untrusted Repository Issues
If it’s your first time installing a module, you might encounter a warning regarding untrusted repositories. If PowerShell prompts you about this, you can resolve the issue by adjusting your execution policy. To allow the installation to proceed, run:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
This command sets the execution policy to allow scripts downloaded from the Internet that are signed by a trusted publisher. Please exercise caution and understand the implications of changing execution policies, as it could affect your system’s security posture.
Disconnect Exchange Online PowerShell Made Easy
Verifying the Installation
Checking Installed Modules
After completing the installation, verifying that the module has been successfully added to your system is crucial. You can do this by executing:
Get-InstalledModule -Name ExchangeOnlineManagement
If the installation was successful, you will see details about the module, including the installed version and other metadata.
Importing the Module
To start using the Exchange Online cmdlets, you need to import the module into your current PowerShell session:
Import-Module ExchangeOnlineManagement
This command makes all commands in the module available for use in your PowerShell session. If you face any issues, ensure that you have the required permissions and that the module is indeed installed.
Mastering PowerShell: Install MSOnline with Ease
Connecting to Exchange Online
Using Modern Authentication
With the module imported, you can now connect to your Exchange Online environment. Modern authentication is recommended for secure connections. Execute the following:
Connect-ExchangeOnline -UserPrincipalName yourUser@domain.com
Replace yourUser@domain.com with your actual Exchange Online account. This command initiates a connection, prompting you for credentials and allowing you to manage Exchange Online through PowerShell.
Troubleshooting Connection Issues
If you encounter any connection issues, common errors may include login failures or authentication errors. Ensure your credentials are correct and that your account has sufficient permissions. You might also want to check your network connection and ensure you are not behind a restrictive firewall.
Mastering the Install-MsolService PowerShell Module
Updating the Exchange Online PowerShell Module
Keeping Your Module Updated
To ensure your module has the latest features and security patches, regularly check for updates. You can update the Exchange Online module by running:
Update-Module -Name ExchangeOnlineManagement
By executing this command, you can keep your environment current and secure.
Managing Multiple Versions
In cases where you have multiple versions of the module installed, you might need to manage which version you are using actively. PowerShell allows you to use specific versions by specifying them in the import command in your script.
Find Exchange Version PowerShell: A Quick Guide
Conclusion
In this article, we have thoroughly explored how to install the Exchange Online PowerShell module. From confirming your prerequisites to connecting to Exchange Online, you are now equipped with the fundamental steps and commands necessary for effective PowerShell usage in managing your Exchange Online environment. Feel free to experiment further with the cmdlets available in this module to streamline your administrative tasks.
Connect to Exchange Server PowerShell: A Quick Guide
Additional Resources
For more detailed information, consider checking the official Microsoft documentation on PowerShell and Exchange Online. Joining PowerShell training courses or communities can also significantly enhance your skills and keep you informed about best practices.
With the newer release of the Powershell Module for Exchange Online I wanted to take the time to show you folks how to get that installed on your system. Microsoft claims that it is more reliable and faster than its predecessor so I wanted to drop a quick post to show you how to install Exchange Online Powershell module.
Some new cmdlets are now prefixed with Get-EXO…
The benefit to having this module as opposed to the version 1 module we previously got from the Exchange Admin Center in portal.office.com is that we can install this across everyone’s profile. The previous module (using Connect-EXOPSSession) was profile based so if Melissa installed it on her profile, it wouldn’t carry over to mine and I would have to go through the process myself. This particularly made it difficult for admins using a shared jumpbox because every new user would need to go through the motions if they wanted the connection. Pretty lame!
Furthermore, just like its predecessor it also supports MFA so you can ensure your security remains intact.
Install Exchange Online Powershell Module From PC With Internet Connection
- From a computer with an internet connection open PowerShell (preferably as an administrator)
- Find-Module -Name ExchangeOnlineManagement
- Install-Module -Name ExchangeOnlineManagement -Scope AllUsers
- Get-Command -Module ExchangeOnlineManagement
Using the -Scope CurrentUser
parameter allows Powershell to install the module without administrator access.
Offline Installation of Exchange Online Management Module
If you’re on a machine that for some reason can’t connect to the internet, or the PSRepository is blocked, that’s ok because we’ll go over the steps to install the module without internet access.
- Hop on a computer with internet access and open PowerShell (preferably as an administrator)
- Find-Module -Name ExchangeOnlineManagement
- Save-Module -Name ExchangeOnlineManagement -Path Path
- Copy the files you downloaded to the offline computer
- Move the copied files to C:\Program Files\WindowsPowerShell\Modules (requires admin rights)
At this point you have the module installed and now it’s a matter connecting to the Exchange Online service.
Connect-ExchangeOnline -UserPrincipalName [email protected] Get-Mailbox username
As mentioned this was going to be a really quick note to show you how to Install Exchange Online Powershell Module so hopefully this articles explains that. If you’re looking what to do with the Powershell or Exchange Online, be sure to check out our own Powershell gallery full of useful real world scripts, tips and tricks. If that’s not something you’re in the mood for, check out the other Exchange Online articles or even our Youtube Channel for more fun in the sysadmin sun.