?
Solved

Powershell command to export specific domain from exchange 2007

Posted on 2014-11-13
7
Medium Priority
?
145 Views
Last Modified: 2014-11-13
The command I use is below and works perfect to export user list. I want to use the below command but only want to export a specific domain. What do I need to add to the below command

Get-Mailbox -ResultSize unlimited |
where{$_.HiddenFromAddressListsEnabled -eq $false} | Select DisplayName, SAMAcco
untname, primarysmtpaddress |export-csv c:\userlist.csv
0
Comment
Question by:Sid_F
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 16

Expert Comment

by:Rajitha Chimmani
ID: 40441355
What do you mean by specific domain? Are you looking for specific domain in primary smtp address?
0
 
LVL 6

Author Comment

by:Sid_F
ID: 40441386
I have multiple domains hosted on my exchange server. Users are either user@domainA.com or user@domainb.com I only want users from domainA.com
0
 
LVL 16

Accepted Solution

by:
Rajitha Chimmani earned 2000 total points
ID: 40441391
Try this

Get-Mailbox -ResultSize unlimited |
where{$_.HiddenFromAddressListsEnabled -eq $false -and $_.primarysmtpaddress -like "*domainA.com"} | Select DisplayName, SAMAcco
untname, primarysmtpaddress |export-csv c:\userlist.csv
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 6

Author Comment

by:Sid_F
ID: 40441406
Error message
Select-Object : A positional parameter cannot be found that accepts argument 'S
ystem.Object[]'.
At line:2 char:109
+  where{$_.HiddenFromAddressListsEnabled -eq $false -and $_.primarysmtpaddress
 -like "*domainA.com"} | Select <<<<  DisplayName, SAMAcco untname, primarysmtp
address |export-csv c:\userlist.csv
    + CategoryInfo          : InvalidArgument: (:) [Select-Object], ParameterB
   indingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell
   .Commands.SelectObjectCommand
0
 
LVL 6

Author Comment

by:Sid_F
ID: 40441411
Sorry my fault had space in
0
 
LVL 16

Expert Comment

by:Rajitha Chimmani
ID: 40441412
Get-Mailbox -ResultSize unlimited |where{($_.HiddenFromAddressListsEnabled -eq $false) -and ($_.primarysmtpaddress -like "*domainA.com")} | Select DisplayName, SAMAccountname, primarysmtpaddress |export-csv c:\userlist.csv

Open in new window

0
 
LVL 6

Author Comment

by:Sid_F
ID: 40441416
Worked perfect thanks
0

Featured Post

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Read this checklist to learn more about the 15 things you should never include in an email signature.
Unified and professional email signatures help maintain a consistent company brand image to the outside world. This article shows how to create an email signature in Exchange Server 2010 using a transport rule and how to overcome native limitations …
In this video we show how to create an Accepted Domain in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Ac…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question