Hi,
Did you run the cmdlets in the Exchange Management Shell? The Get-MailContact cmdlet is part of the module ExchangePowerShell.
https://learn.microsoft.com/en-us/powershell/module/exchange/get-mailcontact
To install the Exchange Management Shell you may refer to this link
https://learn.microsoft.com/en-us/exchange/plan-and-deploy/post-installation-tasks/install-management-tools
Best Regards,
Ian Xue
============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.