If this is for an on-premises Exchange, try the New-MailboxExportRequest cmdlet. Be sure to read the cmdlet's help and assign yourself the correct role. The results will be a PST.
There are other ways, too: some-of-the-many-ways-to-export-outlook-contacts
export-a-users-exchange-online-contact-list-folder-with-graph-api
For Exchange Online, using Get-RESTMethod would probably be the fastest way to the contacts, though: oneliner-mailbox-access-in-powershell.html