Forum Discussion
rootwontfall
Jun 08, 2019Copper Contributor
Script to export to CSV all Mailboxes and SharedMailboxes
Hi, I'm trying to make a new script in Powershell to display (for a report) the following attributes in a CSV table like this: DisplayName UserPrincipalName Licenses RecipientTypeDetails ...
VasilMichev
Jun 08, 2019MVP
Those are pretty much the most commonly asked for attributes, do a search online and use one of the dozens of already available scripts.
- Andrew PriceJun 09, 2019Brass ContributorHi
As Vasil mentioned there is plenty of scripts out there to assist with this issue. This issue is also a great step stone for building your own solid powershell scripts.
Sharing your current code would help people like myself and Vasil guide on how to get your script into the place you would like it to be.
I also suggest looking at PowerShell ISE Steriods, it's a minor cost but helps massively improve your scripting. - suvom3171Mar 29, 2022Copper ContributorHi Vasil,
How add department column with this below powershell:
Get-Mailbox -ResultSize Unlimited | Select DisplayName,UserPrincipalName,RecipientTypeDetails,TotalItemSize,@{Name='Licenses';Expression={(Get-MsolUser -UserPrincipalName $_.UserPrincipalName | Select -ExpandProperty Licenses).AccountSkuID}} | Export-CSV -NoTypeInformation $env:USERPROFILE\Desktop\File.CSV