Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

powershell display output

Posted on 2013-12-11
4
Medium Priority
?
407 Views
Last Modified: 2013-12-12
I am trying to get the email addresses for an exchange 2003 environment. I chose to use quest for this because they do not have powershell for 2010 or 2007.  Please help as I am trying to get this to output per below and the command I am using is fucntional just not providing the output I need, thanks

Get-qadobject -size 0 -searchroot Contoso.local/company |  where {$_.PrimarySMTPAddress -ne $null -and $_.proxyadd
resses -ne $null } | select primarysmtpaddress, @{name="proxyaddresses";expression={$_.proxyaddresses }}

primarysmtpaddress            proxyaddresses
somename@contoso.local            somename@contoso.local, smtp:sname@contoso.local, somen@contoso.local
somename1@contoso.local            somename1@contoso.local, smtp:sname1@contoso.local, somen1@contoso.local
somename2@contoso.local            somename2@contoso.local, smtp:sname2@contoso.local, somen2@contoso.local
somename3@contoso.local            somename3@contoso.local, smtp:sname3@contoso.local, somen3@contoso.local



Here is what I am looking for

primarysmtpaddress
somename@contoso.local
                        smtp:somename@contoso.local
                        smtp:sname@contoso.local
                        smtp:somen@contoso.local
somename1@contoso.local
                        smtp:somename1@contoso.local
                        smtp:sname1@contoso.local
                        smtp:somen1@contoso.local            
            
somename2@contoso.local
                        smtp:somename2@contoso.local
                        smtp:sname2@contoso.local
                        smtp:someno2@contoso.local
0
Comment
Question by:techdrive
[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
  • 2
  • 2
4 Comments
 
LVL 40

Expert Comment

by:Subsun
ID: 39711615
You just want to display it in PowerShell Console? Or want to save it in in that format in a text file?

You may try the result from following code and see if it works for you.. I think it will be easy for you to sort the list in this way..

Get-qadobject -size 0 -searchroot Contoso.local/company |  
 where {$_.PrimarySMTPAddress -ne $null -and $_.proxyaddresses -ne $null } | % {
 $primarysmtpaddress = $_.primarysmtpaddress
	$_.proxyaddresses | % {
		New-object PSObject -Property @{
		primarysmtpaddress = $primarysmtpaddress
		proxyaddresses = $_
		}
	}
}| Export-Csv C:\report.csv -NTI

Open in new window

0
 

Author Comment

by:techdrive
ID: 39714985
last question what if I wanted to add additional fields. Is there an easy way I tried and it failed.
0
 
LVL 40

Accepted Solution

by:
Subsun earned 2000 total points
ID: 39715008
Ok..Try this example, you can add additional properties as i shown in this example..

Get-qadobject -size 0 -searchroot Contoso.local/company |  
 where {$_.PrimarySMTPAddress -ne $null -and $_.proxyaddresses -ne $null } | % {
 $user = $_
	$_.proxyaddresses | % {
		New-object PSObject -Property @{
		primarysmtpaddress = $user.primarysmtpaddress
		proxyaddresses = $_
		Displayname = $user.Displayname
		Alias = $user.Displayname
                Samaccountname = $user.samaccountname
		}
	}
}| Export-Csv C:\report.csv -NTI

Open in new window

0
 

Author Comment

by:techdrive
ID: 39715054
many thanks
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

609 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