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
MVP
Those are pretty much the most commonly asked for attributes, do a search online and use one of the dozens of already available scripts.
suvom3171
Mar 29, 2022Copper Contributor
Hi 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
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