question

MichaelL369-8184 avatar image
0 Votes"
MichaelL369-8184 asked ·

PowerShell - Getting Contacts From A Specific Mailbox

Using PowerShell, when I connect to Exchange with my credentials (I'm an admin) and use Get-Contact, I get all the contacts defined under Exchange->Recipients->Contacts. However, what I want to do is pull the actual contacts defined within a user's account. If I connect to Exchange with the mailbox's credentials rather than mine, I do not have access to the Get-Contact command. I'm not a PowerShell expert, so I'm not sure if this is done with impersonation, Get-Mailbox or some other method. How do I accomplish what I am trying to do? Thanks

windows-server-powershell
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

RichMatheisen-8856 avatar image
0 Votes"
RichMatheisen-8856 answered ·

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


·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MichaelL369-8184 avatar image
0 Votes"
MichaelL369-8184 answered ·

Thank you for your response. I was able to export the list using the script located in some-of-the-many-ways-to-export-outlook-contacts,



However, when I spoke about getting contacts from a specific user's mailbox I failed to mention the need to update them as well. So if anyone knows of a solution that works for listing/exporting and updating, please let me know.

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

RichMatheisen-8856 avatar image
0 Votes"
RichMatheisen-8856 answered ·

Something like this? powershell-bulk-change-contacts


·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.