Avatar of landfemail
landfemail
Flag for United States of America asked on

Exchange command for some attributes

Hi,
Is there a command that will get me all these attributes ?
First, last name, displayname, primary email address, UPN ,samaccountname,all others smtp address ,OU and status ( disabled or enabled)
Thank you.
Exchange

Avatar of undefined
Last Comment
landfemail

8/22/2022 - Mon
Ogandos

Get-ADUser -Filter * -Property * | Select-Object -Property GivenName,SureName,DisplayName,EmailAddress,UserPrincipalName,SamAccountName,ProxyAddresses,DistinguishedName,Enabled
landfemail

ASKER
and is it possible to put in excel ?
Ogandos

Yeap, we can save on your desktop like this...

Get-ADUser -Filter * -Property * | Select-Object -Property GivenName,SureName,DisplayName,EmailAddress,UserPrincipalName,SamAccountName,ProxyAddresses,DistinguishedName,Enabled | Export-Csv -Path $Home\Desktop\MyUsers.csv
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
landfemail

ASKER
proxy addresses gives me all information, is there another command for showing smtp addresses
landfemail

ASKER
Thank you but when i put it in cvs or txt file "surname" and "proxy addresses" shows as : Microsoft.ActiveDirectory.Management.ADPropertyValueCollection and no data on them.
ASKER CERTIFIED SOLUTION
Jeff Glover

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Jeff Glover

Oops. Small typo in the Script copy. Use this one instead
ADUsers.vbs.txt
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
landfemail

ASKER
Great script. thanks