Get List of mailboxes with specific EmailAddresses (Enabled & Disabled)
Hi Guys,
I have come up with a powershell that gives me list of mailboxes with certain specific emailaddresses.
$TempMailboxes = Get-Mailbox -ResultSize Unlimited -Filter {Emailaddresses -like "*@domain.com"} | select Name,PrimarySmtpAddress | Sort-Object Name | Export-Csv c:\report.csv |
How can i modify the script to add to the report if the mailbox is enabled or disabled? (It will be awesome if i get both the mailbox enable or disable status plus the AD account)
July 20th, 2015 12:51pm
That's going to be tricky to do in a one-line command because you need to use a different cmdlet, Get-ADUser, for the enabled/disabled status. It may be possible, but I'd write a script that loops through the mailboxes, collects the data and writes
the report.
July 20th, 2015 1:34pm
Try this...
$TempMailboxes = Get-Mailbox -ResultSize Unlimited -Filter {Emailaddresses -like "*@domain.com"} | select Name,PrimarySmtpAddress,@{Name="Disalbed?";Expression={Get-User $_.Identity).UserAccountControl}} | Sort-Object Name | Export-Csv
c:\report.csv
July 20th, 2015 6:46pm