Useful Script for exporting Users from AD/Exchange

Reading Time: < 1 minute

Script to export list of users with forwarders configured

Get-mailbox | select DisplayName,ForwardingAddress | where {$_.ForwardingAddress -ne $Null} | select DisplayName,ForwardingAddress | where {$_.ForwardingAddress -ne $Null} | out-string -Width 999 > c:\ListOfForwarders.txt

List mailboxes where Automatically update email addresses is set to disabled

Get-Mailbox -ResultSize Unlimited | Where {$_.EmailAddressPolicyEnabled -eq $False} > c:\AddressUpdateDisabled.txt

Mailboxes with Send As Permission

get-mailbox | Get-ADPermission | ? { ($_.ExtendedRights -like “send“) -and -not ($_.User -like “\self“) } | FT -auto identity, User,ExtendedRights | out-string -Width 999 > c:\sendAsConfigured.txt

Export users where the primary SMTP does not match the UPN

Get-ADUser -Filter {Mail -like “*”} -Properties Mail,UserPrincipalName,CN |? {$_.UserPrincipalName -ne $_.Mail} | Select Mail,UserPrincipalName,CN | out-string -Width 999 > c:\UPNDoesNotMatch.txt

Export all user accounts

get-user -resultsize unlimited | FT DisPlayName, SamaccountName, SID, UserPrincipalName, WindowsEmailAddress | out-string -Width 150 > c:\AllUsers.txt

List In-Policy bookings settings on resource mailboxes

Get-MailBox | where {$_.ResourceType -eq “equipment”} | Get-CalendarProcessing | Format-List > c:\resourceMbx.txt

Export domain accounts and Mailbox statistics

get-Mailbox -resultsize unlimited | Get-MailboxStatistics | FT DisplayName, MailboxGuid, ItemCount, TotalIDeletedtemSize, TotalItemSize | out-string -Width 999 > c:\MailboxStats.txt

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.