SOLVED

powershell query

Brass Contributor

Hi All ,

 

I am using below command to get a list of all active users in AD, what should i add to this command to get UPN and Object ID ?

 

Get-ADUser -Filter {Enabled -eq $true} -properties * | select-object samaccountname,givenname,surname,Enabled | export-csv -path c:\temp\Enabledexportusers.csv

 

Thanks in Advance

Alex

2 Replies
best response confirmed by alexrabbi (Brass Contributor)
Solution
List all the properties you want included in the CSV as part of the select-object cmdlet:

Select-Object UserPrincipalName,ObjectId,samaccountname,givenname,surname,Enabled
Thanks Vasil, that worked
1 best response

Accepted Solutions
best response confirmed by alexrabbi (Brass Contributor)
Solution
List all the properties you want included in the CSV as part of the select-object cmdlet:

Select-Object UserPrincipalName,ObjectId,samaccountname,givenname,surname,Enabled

View solution in original post