Link to home
Start Free TrialLog in
Avatar of Jorge Ocampo
Jorge OcampoFlag for United States of America

asked on

powershell script help

any ideas on the below?

Get-ADUser -filter * -Properties DisplayName, EmailAddress, proxyAddresses, distinguishedName | select DisplayName, EmailAddress, proxyAddresses, distinguishedName | export-csv c:\temp\Email.csv –NoTypeInformation

i get the below in the export it has to do with multivalued attributes

proxyAddresses
Microsoft.ActiveDirectory.Management.ADPropertyValueCollection
Microsoft.ActiveDirectory.Management.ADPropertyValueCollection
Microsoft.ActiveDirectory.Management.ADPropertyValueCollection
Microsoft.ActiveDirectory.Management.ADPropertyValueCollection
Microsoft.ActiveDirectory.Management.ADPropertyValueCollection
Microsoft.ActiveDirectory.Management.ADPropertyValueCollection
Microsoft.ActiveDirectory.Management.ADPropertyValueCollection
Microsoft.ActiveDirectory.Management.ADPropertyValueCollection
Microsoft.ActiveDirectory.Management.ADPropertyValueCollection
Microsoft.ActiveDirectory.Management.ADPropertyValueCollection
Avatar of oBdA
oBdA

Try it like this:
Get-ADUser -filter * -Properties DisplayName, EmailAddress, proxyAddresses, distinguishedName | select DisplayName, EmailAddress, @{n='proxyAddresses'; e={$_.proxyAddresses -join ', '}}, distinguishedName | export-csv c:\temp\Email.csv –NoTypeInformation

Open in new window

oBdA, your carriage return broken? :p
Ah, less than 255 chars, that's barely over two lines in the default PS console ...
Get-ADUser -Filter * -Properties DisplayName, EmailAddress, ProxyAddresses, DistinguishedName |
	Select-Object -Property `
		DisplayName,
		EmailAddress,
		@{Name='ProxyAddresses'; Expression={$_.ProxyAddresses -join ', '}},
		DistinguishedName |
	Export-Csv -Path C:\temp\Email.csv –NoTypeInformation

Open in new window

Avatar of Jorge Ocampo

ASKER

@oBdA

didnt have any issues but is there a possible way to only get the primarysmtp "SMTP"
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial