Retrieving Active Directory user properties via PowerShell

on

This is all done via Get-ADUser

help Get-ADUser

 

Get-ADUser -identity username -properties *

 

get-aduser -filter * -properties passwordlastset, passwordneverexpires |ft Name, passwordlastset, Passwordneverexpires

With that in mind, lets see a script that exports all data to a CSV while also sorting the objects by Name:

 

Get-ADUser -filter * -properties passwordlastset, passwordneverexpires | sort-object name | select-object Name, passwordlastset, passwordneverexpires | Export-csv -path C:\Temp\AD-Report.csv

 

Leave a Reply

Your email address will not be published. Required fields are marked *