Powershell to export Public Folder Proxyaddresses from Exchange 2003

Hi Guys.

I'm trying to export a list of all SMTP's assigned to my Ex2003 mail enabled Public Folders using the Get-QADObject cmdlet against the 'microsoft exchange system objects' container, but I am having a few problems.

I am using the code below, but when I run it, all I get is "System.Object[]"" as the output next to the Folder name.

I've tried using the '-width' setting, and this does work (ish), but the problem is that some of my PF's have 100 Fax addresses and only one smtp, and even at a very wide width (which leads to a huge output file) I am not 100% sure it is exporting every smtp, and anyway, I only want the SMTP's, not the Fax addresses.

I planned to use this export and manipulate in Excel, but what I would ideally like, is a list of folders, and their SMTPs only next to them, and if I can do that directly from within PS, then great, ie -

folder1, smtp1, smtp2
folder2, smtp1, smtp2, smtp3
folder3, smtp1, smtp2
etc.

I am sure I doing something daft, or doing it cmpletely the wrong way, but help would be appreciated!

Thanks,
Dave.


Get-QADObject -SearchRoot 'my.domain.com/microsoft exchange system objects' -IncludedProperties proxyaddresses | select name,proxyaddresses | Out-File c:\pfsmtpexport.txt

Open in new window

undercover69Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chris DentPowerShell DeveloperCommented:
Hi Dave,

This is caused by proxyAddresses, it is an array (signified by []) not a single value. When you use it like this you get an implicit "ToString()" call on the value, in this case that gives you System.Object[] rather than the actual values.

If you make PowerShell join the array into a string it should be a lot happier. In this case we can do that by enclosing the original value in quotes and selecting it as a custom property.

Chris
Get-QADObject `
    -SearchRoot 'my.domain.com/microsoft exchange system objects' `
    -IncludedProperties proxyAddresses | `
  Select-Object Name, @{n='proxyAddresses';e={"$($_.proxyAddresses)"}} | `
  Out-File c:\pfsmtpexport.txt

Open in new window

0
undercover69Author Commented:
Hi Chris,

Thanks again for the expert help!

One thing though, I am still getting all the data from the proxyaddresses field (ie including the Fax addresses), whereas I only really want the SMTP addresses.
I can export from here out to excel and then mess about with it there, but for training purposes (:-)) can can it be filtered from PS?

Thanks again,
Dave
0
Chris DentPowerShell DeveloperCommented:
Hi Dave,

Yes, certainly, this should do it if you'd care to give it a shot.

Chris
Get-QADObject `
    -SearchRoot 'my.domain.com/microsoft exchange system objects' `
    -IncludedProperties proxyAddresses | `
  Select-Object Name, @{n='proxyAddresses';e={"$($_.proxyAddresses | ?{ $_ -Like 'smtp*' })"}} | `
  Out-File c:\pfsmtpexport.txt

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
undercover69Author Commented:
Great stuff Chris, thanks again mate :-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.