Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $Users = Get-ADUser -Filter {Enabled -ne $true} -Properties Name
- $Data = @()
- ForEach($User in $Users){
- $mailbox = Get-Mailbox -Identity $User.Name | Where {$_.ForwardingAddress -ne $null}
- $Data += New-Object -TypeName PSObject -Property @{DisplayName = $mailbox.DisplayName;
- ForwardingAddress = $mailbox.ForwardingAddress}
- }
- $Data | Select DisplayName, ForwardingAddress | Export-Csv -LiteralPath C:/ForwadingDisabledUsers.csv -Append
Advertisement
Add Comment
Please, Sign In to add comment