Need help with large environment export

Hi guys, need help with get-mailbox cmdlet exports

I have a large exchange 2013 on-prem environment
110+ servers, over 150k mailboxes
how can I efficiently run cmdlets to get get mailbox permissions
all examples point to get-mailbox -resultsize unlimited piped to get-mailboxpermsisions
as you can imagine, this crashes after running out of memory.

Right now I am using get-mailbox-server | get-mailbox-database foreach mailbox database to get though it without exhausting memory, but it’s taking a very long time with 10K databases

Can anyone offer a more efficient manor to get these results?

I’ve got a module that I’ve used successfully for this - it exports the permissions to csv as it goes. it’s got some rough edges right now and you may have to tweak a bit. Feel free to put in a pull request or issue over on Github. https://github.com/exactmike/ExchangePermissionsExport