If you are an IT manager like I do, you sometimes need to execute commands in PowerShell because it’s just don’t exist in the admin center UI. And if you’re working on (and new on) a Mac like I do, it’s not easy to do.

This is a documentation of the steps I went through to install everything from scratch until I am able to execute Microsoft admin command in PowerShell running on a Mac.

Today is 24 February 2025 and I am running Mac OS Sequoia on an M2 Macbook Pro.

Open Terminal

  • If you don’t know it yet, open Terminal (like a cmd in Windows) by pressing Command-Space and type Terminal.

Install HomeBrew

  • In the terminal, type this command and press enter:
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)";
  • terminal window on homebrew installation
  • Wait until it finishes.
  • After it completes, to test it, type this command and press enter: brew
  • If it shows example usages of brew, you’re good to continue to the next step.

Install PowerShell

  • In the terminal, type this command and press enter:
    brew install powershell/tap/powershell
  • Wait until the installation finishes.
  • If that didn’t work the first time, try closing your Terminal, open a fresh one, and try the command again.
  • After it completes, to test it, type this command and press enter: pwsh
  • If it shows the PowerShell version, you’re good to continue.

Install OpenSSL

  • In your terminal, type this command and press enter:
    brew install openssl@3
  • If by the time you are installing, OpenSSL 3 is not the latest, use the latest version. Check from here and type OpenSSL on the search box: https://formulae.brew.sh/formula/openssl@3#default

Opening PowerShell

  • In your terminal, open PowerShell in Super User mode with this command and press enter:
    sudo pwsh

Install Exchange Online PowerShell Module

  • In your PowerShell, type this command and press enter:
    Install-Module -Name PSWSMan
  • Do it again for this command:
    Install-WSMan
  • Again, with this command:
    Install-Module -Name ExchangeOnlineManagement -Scope CurrentUser

Connect to your Microsoft 365 subscription

  • Type this command, change the <UPN> with your admin email address, and press enter:
    Connect-ExchangeOnline -UserPrincipalName <UPN>
  • A Safari window will open, sign in with your Microsoft Account

That’s it!

You should be able to run a PowerShell admin command now.

Sample command: Get-Mailbox -ResultSize unlimited -Filter "RecipientTypeDetails -eq 'RoomMailbox'" | Get-CalendarProcessing | Format-List Identity,ScheduleOnlyDuringWorkHours,MaximumDurationInMinutes

Arfian

Arfian Agus adalah seorang profesional di bidang teknologi dan inovasi digital dengan fokus pada transformasi digital, desain, dan pengembangan produk. Dengan pengalaman yang luas dalam memimpin proyek-proyek teknologi dan menyusun strategi inovasi, Arfian berkomitmen untuk membantu perusahaan beradaptasi dan berkembang di era digital.

Stay in the loop

Subscribe to our free newsletter.