• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1304
  • Last Modified:

Exchange Query for Forwarding users

Hi,

I have a query that exports users that are NOT having their emails forwards. I need one that shows me which ARE having their emails forwarded, I thought I just needed to add $true in the query instead of $null, but it's not working.


Get-Mailbox -Filter { ForwardingAddress -eq $Null } | Select-Object PrimarySmtpAddress,
    SamAccountName, DisplayName,
    @{n='Department';e={ (Get-User $_.DistinguishedName).Department }} |
  Export-Csv C:\noforward.csv -NoTypeInformation
Get-Mailbox -Filter { ForwardingAddress -eq $Null } | Select-Object PrimarySmtpAddress, 
    SamAccountName, DisplayName,
    @{n='Department';e={ (Get-User $_.DistinguishedName).Department }} | 
  Export-Csv C:\noforward.csv -NoTypeInformation

Open in new window

0
Methodman85
Asked:
Methodman85
2 Solutions
 
Richard2k4Commented:
have you tried get-mailbox -filter { ForwardingAddress -gt $Null}

0
 
AmitIT ArchitectCommented:
Try This

Get-Mailbox | Where {$_.ForwardingAddress -ne $null} | Select Name, ForwardingAddress, DeliverToMailboxAndForward
0
 
Methodman85Author Commented:
Thank you good sirs, both worked!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Worried about phishing attacks?

90% of attacks start with a phish. It’s critical that IT admins and MSSPs have the right security in place to protect their end users from these phishing attacks. Check out our latest feature brief for tips and tricks to keep your employees off a hackers line!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now