Fix New-MailContact Not Recognized Error in Exchange PowerShell
Question details
The user is unable to run the New-MailContact cmdlet while attempting to bulk-import external contacts into Exchange Online.

- Product
- Exchange Online / Microsoft 365
- Device & OS
- Mac (MacBook Pro)
- Scenario
- Bulk-importing external contacts into Exchange Online using PowerShell commands.
- Observed behavior
- The New-MailContact cmdlet is not recognized as the name of a cmdlet. The user is mistakenly attempting to run PowerShell commands directly through a web browser (Safari) instead of a properly configured PowerShell terminal.
Ensure you have global administrator or Exchange administrator privileges in your Microsoft 365 tenant, and verify that you are running a native PowerShell terminal application rather than a web browser.
Set Up PowerShell Environment on Mac and Connect to Exchange
Install the native PowerShell environment and required Exchange Online modules on macOS to successfully execute cmdlets.
PowerShell commands cannot be executed directly from a web browser like Safari. You must install the PowerShell app for macOS and the official Exchange Online Management module to interact with your Microsoft 365 environment.
Download and install PowerShell Core for macOS via Homebrew by running 'brew install --cask powershell' in your Mac Terminal, or download the installation package directly from Microsoft's GitHub repository.
Open the PowerShell terminal application on your Mac and run the command 'Install-Module -Name ExchangeOnlineManagement -Force' to install the required module for Exchange cmdlets.
Authenticate your administrative session by running 'Connect-ExchangeOnline -UserPrincipalName youradmin@yourdomain.com' and signing in with your Microsoft 365 credentials.
Once connected, test the connection by running a basic cmdlet like 'Get-Mailbox'. If successful, proceed with your 'New-MailContact' script to bulk import your external contacts.

Verify and Assign Management Roles
Ensure your administrator account has the proper 'Mail Recipients' role required to create new mail contacts.
Manage Your Office Work Seamlessly with WPS Office
While you configure and troubleshoot complex Microsoft 365 Exchange settings, consider WPS Office for your everyday document, spreadsheet, and presentation needs. It is a powerful, lightweight, and free alternative to the Microsoft Office desktop suite, perfect for users seeking high performance without heavy subscription costs.
- 1. Download the Installer: Navigate to the official WPS Office website and click the Free Download button for your operating system.
- 2. Install the Suite: Run the downloaded installer file and follow the quick on-screen prompts to set up the software.
- 3. Open Your Files: Launch WPS Office and directly open your existing Word, Excel, or PowerPoint files with perfect formatting preservation.

Frequently Asked Questions
Can I run Exchange PowerShell commands directly in a Mac web browser like Safari?
No, web browsers cannot execute local PowerShell modules. You must install the native PowerShell Core application for macOS and run commands directly through the terminal interface.
Why does Get-Item return 'not recognized' with a C:\Windows file path on my Mac?
macOS uses a different file system architecture than Windows. Commands referencing 'C:\Windows\System32\...' will fail on a Mac because those file paths do not exist in the macOS environment.
Which specific PowerShell module is required to run New-MailContact in Microsoft 365?
You need the 'ExchangeOnlineManagement' module. Older modules like AzureAD or MSOnline (which are being deprecated) do not contain Exchange-specific cmdlets like New-MailContact.
Why is a cmdlet still unrecognized after installing the ExchangeOnlineManagement module?
This usually happens if you have not successfully authenticated your session using the 'Connect-ExchangeOnline' command, or if your user account lacks the Exchange administrative roles required to use that specific cmdlet.




