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

Powershell - Get ProxyAddresses and output to seperate row

I need to grab a list of proxyaddresses from users, contacts and groups and output to a text file, with only one proxy address listed per line in the output file, but also filter out any proxyaddresses that do not match "domain1.com" i.e


I have the below powershell script which outputs on screen what I want,
get-qadobject -OrganizationalUnit -sizeLimit 0 -ip proxyAddresses |
select-object -expand proxyAddresses | where {$_.endswith('@domain1.com')}

however when exporting to csv the output is the below format

#TYPE System.String

Any ideas on how i can get a nice export file with only the filtered proxyaddresses listed on a seperate line?
  • 3
1 Solution
Krzysztof PytkoActive Directory EngineerCommented:
This is due to incompatibility of string output. You need to convert first this to string.
I'm not big programmer in PowerShell, so please check that only for your information and try to use that or wait for another expert for professional help

In the meantime, if you're interested, please similar thread at this forum where yo_bee had the same problem but in different cmd-let output. He provided at the end all required steps

Rajitha ChimmaniCommented:
What is the command that you are using to export to csv?
Rajitha ChimmaniCommented:
Is it fine if we use the Exchange commands instead of QAD cmdlets? Hope you are doing it for Exchange/email enabled objects only.
Rajitha ChimmaniCommented:
For Exchange, you can use the below command

Get-Mailbox -Resultsize unlimited | foreach{$_.Emailaddresses} | where {$_.smtpaddress.endswith('@domain1.com')} | export-csv test.csv -NoClobber -NoTypeInformation

You may find some errors on powershell screen but thats normal as few email addresses (X400 or X500) dont have the parameter SMTPAddress within them.
ColliersInternationalAuthor Commented:
Exactly the ouput I required. Thanks.

Featured Post

Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

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