Forum Discussion
alexrabbi
Dec 22, 2022Brass Contributor
powershell query
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
- 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
2 Replies
- 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- alexrabbiBrass ContributorThanks Vasil, that worked