I have a command which would I would have to define the username of user and this will display the username, name and expiry date of the user:
$user = "Username of User"
get-aduser $user -property * | select samaccountname, displayname, accountexpirationdate
Which outputs:
samaccountname displayname accountexpirationdate
-------------- ----------- ---------------------
Username Name of User 02/11/2023 00:00:00
I was wondering if it possible to define a list of usernames either in .txt file or CSV file and create a script to read text/csv file of each username and to pull off the username, display name and expiry date of that user to CSV file.