We help IT Professionals succeed at work.

Powershell script to list users not on a distribution list

Mike Walker
Mike Walker asked
on
160 Views
Last Modified: 2018-04-25
I have an Exchange 2007 server and am needing a powershell script to look at a distribution list with nested distribution lists inside of it and then export a csv of all the mailboxes not in this distribution list.

The DL looks similar to this:
entirecompanydl
  dept 1
    dept1 directors office
    dept1 people
  dept 2
    dept2 directors office
    dept 2 people
Comment
Watch Question

Senior Consultant
CERTIFIED EXPERT
Awarded 2017
Distinguished Expert 2019
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION

Author

Commented:
Sadly Get-Recipient is not a cmdlet in Exchange 2007
Shaun VermaakSenior Consultant
CERTIFIED EXPERT
Awarded 2017
Distinguished Expert 2019

Commented:
This person is using it in Exchange 2007. Do you have SP3 CU15+ installed?

Author

Commented:
I'm running Exchange 2007 SP3 UR17
Shaun VermaakSenior Consultant
CERTIFIED EXPERT
Awarded 2017
Distinguished Expert 2019

Commented:

Author

Commented:
I guess by default I was running it in powershell without the Exchange snapin. When I threw in:

"add-pssnapin Microsoft.Exchange.Management.PowerShell.Admin"

Everything worked.