Powershell, MFA and Running as an Administrator

Australia | Powershell, MFA and Running as an Administrator

Microsoft are (rightly) increasingly encouraging users to implement MFA in order to access Office 365. In fact, they’ve rolled out baseline conditional access polices which force this on admins and users (currently, these are disabled by default but expect it to change in the future).

So, what do you do if you want to use remote PowerShell to manage your Exchange Online service when MFA ? Well, of course you install the Exchange Online Remote PowerShell Module. This module is available as a download via the Exchange Online admin centre (click on the hybrid tab as per the below image).

Australia | Powershell, MFA and Running as an Administrator

Once you run the installer, it will connect to Office 365 to download the latest source files and install the module.

NOTE: I have had issues attempting to install when using Multi-account containers in Firefox, so if you do experience issues with the install, try IE or Edge.

Once the install completes you have a nice new shortcut on your desktop:

Australia | Powershell, MFA and Running as an Administrator

time the shortcut is run, the application verifies it is the latest version and updates itself if required, then starts PowerShell with the module loaded:

Australia | Powershell, MFA and Running as an Administrator

As the window says, you simply run Connect-EXOPSSession and you will be prompted for your credentials and any MFA requirements as part of authentication. This module is also used for the security and compliance services, and y!

The problem comes when you need to run the shell as an admin. Normally, we can right-click the PowerShell app and select run as administrator. Unfortunately, because it’s a shortcut on your desktop, we have no such option.

Here’s how I got around this issue:

The shortcut by default points to the install files generally located in %USERPROFILE%AppDataLocalApps2 then some variable name folders. The executable which is run is named Microsoft.Online.CSE.PSModule.Client.exe.

By pining this file to the taskbar, you can now right-click it and select run as administrator (as per the image below) and perform all those tasks which require the PowerShell shell to be run as an administrator (surely we don’t run unsigned scripts!).

Australia | Powershell, MFA and Running as an Administrator

One thing that you will need to be wary of is that running the executable directly via the taskbar bypasses the verification that the module is the latest version, so you will need to execute the desktop shortcut fairly regularly to make sure you are running the latest version. And if it is updated, you’ll probably find that you have go through the above again as the path to the file will have changed.

I hope this blog has provided some help to you. Let me know if you’ve found anything else out there that makes it easier to do this.

THANK YOU FOR YOUR SUBMISSION!

Australia | Powershell, MFA and Running as an Administrator

The form was submitted successfully.

Join the Insentra Community with the Insentragram Newsletter

Hungry for more?

If you’re waiting for a sign, this is it.

We’re a certified amazing place to work, with an incredible team and fascinating projects – and we’re ready for you to join us! Go through our simple application process. Once you’re done, we will be in touch shortly!

Who is Insentra?

Imagine a business which exists to help IT Partners & Vendors grow and thrive.

Insentra is a 100% channel business. This means we provide a range of Advisory, Professional and Managed IT services exclusively for and through our Partners.

Our #PartnerObsessed business model achieves powerful results for our Partners and their Clients with our crew’s deep expertise and specialised knowledge.

We love what we do and are driven by a relentless determination to deliver exceptional service excellence.

Australia | Powershell, MFA and Running as an Administrator

Insentra ISO 27001:2013 Certification

SYDNEY, WEDNESDAY 20TH APRIL 2022 – We are proud to announce that Insentra has achieved the  ISO 27001 Certification.