{"id":4723,"date":"2025-11-23T13:43:30","date_gmt":"2025-11-23T13:43:30","guid":{"rendered":"https:\/\/geekmungus.co.uk\/?p=4723"},"modified":"2025-11-23T13:43:31","modified_gmt":"2025-11-23T13:43:31","slug":"install-and-use-microsoft-exchange-online-powershell-modules-developer-machine","status":"publish","type":"post","link":"https:\/\/geekmungus.co.uk\/?p=4723","title":{"rendered":"Install and Use Microsoft Exchange Online PowerShell Modules (Developer Machine)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The document provides a simple guide to how to install and use the Microsoft Exchange Online PowerShell modules to interact with Microsoft 365 infrastructure for the purposes of administering the Microsoft 365 infrastructure and applications; i.e. how to setup your Developer Machine.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You may be able to install modules without administrative rights by adding the &#8220;scope&#8221; argument, for example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Install-Module -name &lt;whatever> -scope CurrentUser<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The installation of the Microsoft Exchange Online Management PowerShell modules can be a bit involved.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"InstallandUseMicrosoftExchangeOnlinePowerShellModules(DeveloperMachine)-Step1-InstallModule(s)\">Step 1 &#8211; Install Module(s)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">There are a few steps to perform:\u00a0<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Install-Module PowerShellGet -Force<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If you see the error &#8220;Error: PowerShellGet Requires NuGet&#8230;.&#8221;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"966\" height=\"485\" src=\"https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/11\/image-17.png\" alt=\"\" class=\"wp-image-4724\" srcset=\"https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/11\/image-17.png 966w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/11\/image-17-300x151.png 300w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/11\/image-17-768x386.png 768w\" sizes=\"auto, (max-width: 966px) 100vw, 966px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">To resolve run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;Net.ServicePointManager]::SecurityProtocol = &#91;Net.SecurityProtocolType]::Tls12<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Install-PackageProvider -Name NuGet<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You may also need to run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Install-Module PowerShellGet -Force -AllowClobber<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now, you are ready to install the Microsoft Exchange Online module. So let&#8217;s do that.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Install-Module ExchangeOnlineManagement<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You can also add on the end&nbsp;<strong>-Scope CurrentUser<\/strong>&nbsp;to avoid needing administrative permissions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The installation may take a few minutes.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Upgrade (if Required)<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">To upgrade the existing version you can run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Update-Module -Name ExchangeOnlineManagement<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">To verify its upgraded to the expected version you can run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Get-InstalledModule ExchangeOnlineManagement<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You&#8217;ll get an output such as:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"77\" src=\"https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/11\/image-18-1024x77.png\" alt=\"\" class=\"wp-image-4725\" srcset=\"https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/11\/image-18-1024x77.png 1024w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/11\/image-18-300x22.png 300w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/11\/image-18-768x57.png 768w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/11\/image-18.png 1483w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"InstallandUseMicrosoftExchangeOnlinePowerShellModules(DeveloperMachine)-Step2-ExampleConnection\">Step 2 &#8211; Example Connection<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Once the module is installed, you can then use it, however you may need to import it before you can use it.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Import-Module ExchangeOnlineManagement<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Remember PIM, if you require elevated permissions, ensure you have elevated permissions via PIM before you complete these steps.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now we can make the connection:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Connect-ExchangeOnline -UserPrincipalName &lt;UPN> &#91;-ExchangeEnvironmentName &lt;Value>] &#91;-ShowBanner:$false] &#91;-DelegatedOrganization &lt;String>] &#91;-SkipLoadingFormatData]<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Here&#8217;s a simple example connection command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Connect-ExchangeOnline -UserPrincipalName fred.bloggs@domain.com<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You may be redirected to your organisation&#8217;s SSO to enter your passowrd, and challenged for MFA response.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you are prompted for signing in all desktop apps, click on &#8220;No, this app only&#8221;, we only want to use this user session with our PowerShell window.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"290\" src=\"https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/11\/image-19.png\" alt=\"\" class=\"wp-image-4726\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Once successfully connected you should see:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"238\" src=\"https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/11\/image-20-1024x238.png\" alt=\"\" class=\"wp-image-4727\" srcset=\"https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/11\/image-20-1024x238.png 1024w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/11\/image-20-300x70.png 300w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/11\/image-20-768x178.png 768w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/11\/image-20-1536x356.png 1536w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/11\/image-20.png 1629w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"InstallandUseMicrosoftExchangeOnlinePowerShellModules(DeveloperMachine)-Step3-PerformaTestQuery\">Step 3 &#8211; Perform a Test Query<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s perform a test query to retrieve all the mailboxes within our Microsoft Exchange Online environment, spoiler alert, we only have 2 in our case!<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>get-mailbox<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And we get this output:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"138\" src=\"https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/11\/image-21-1024x138.png\" alt=\"\" class=\"wp-image-4728\" srcset=\"https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/11\/image-21-1024x138.png 1024w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/11\/image-21-300x40.png 300w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/11\/image-21-768x103.png 768w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/11\/image-21-1536x206.png 1536w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/11\/image-21.png 1629w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"InstallandUseMicrosoftExchangeOnlinePowerShellModules(DeveloperMachine)-Step4-Disconnect\">Step 4 &#8211; Disconnect<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Once you&#8217;ve finished your work, you then need to disconnect, although not essential it is recommended, omit the &#8220;-Confirm:$false&#8221; if you wish to be prompted.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Disconnect-ExchangeOnline -Confirm:$false<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The document provides a simple guide to how to install and use the Microsoft Exchange Online PowerShell modules to interact with Microsoft 365 infrastructure for the purposes of administering the Microsoft 365 infrastructure and applications; i.e. how to setup your Developer Machine. You may be able to install modules without administrative rights by adding the &#8230; <a title=\"Install and Use Microsoft Exchange Online PowerShell Modules (Developer Machine)\" class=\"read-more\" href=\"https:\/\/geekmungus.co.uk\/?p=4723\" aria-label=\"Read more about Install and Use Microsoft Exchange Online PowerShell Modules (Developer Machine)\">Read more<\/a><\/p>\n","protected":false},"author":4,"featured_media":4361,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[54,32,14,60],"tags":[],"class_list":["post-4723","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-microsoft-365","category-microsoft-exchange","category-microsoft-windows","category-powershell"],"_links":{"self":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/4723","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4723"}],"version-history":[{"count":1,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/4723\/revisions"}],"predecessor-version":[{"id":4729,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/4723\/revisions\/4729"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/media\/4361"}],"wp:attachment":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4723"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4723"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4723"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}