Hi Guys,
Trying to Extract "pwdLastSet, Password expires, Password changeable, Password required, User may change password" property for all Staff OU users and export to csv.
Any advice would be greatly appreciated. Thank you
Hi Guys,
Trying to Extract "pwdLastSet, Password expires, Password changeable, Password required, User may change password" property for all Staff OU users and export to csv.
Any advice would be greatly appreciated. Thank you
are there any additional questions? Does the answer help to solve the issue?
If you found the answer helpful, it would be great if you please mark it "Accept as answer". This will help others to find answers in Q&A
Regards
Andreas Baumgarten
the command Get-AdUser should be helpful to get all users of OU:
https://docs.microsoft.com/en-us/powershell/module/activedirectory/get-aduser?view=windowsserver2019-ps#example-1--get-all-of-the-users-in-a-container
With the parameter -Properties * you will get all properties of a user.
Here is a list of all Ad user properties returned by Get-ADUser:
https://social.technet.microsoft.com/wiki/contents/articles/12037.active-directory-get-aduser-default-and-extended-properties.aspx
With the Select-Object command you can filter the properties.
The script could look like this (not tested by myself):
$users = Get-ADUser -Filter * -SearchBase "OU=STAFF,DC=TEST,DC=LOCAL" | Select-Object <propertyname1>,<propertyname2>,<....>
$users | Export-Csv -Path "C:\temp\yourcsvfile.csv" -Encoding utf8 -Delimiter ","
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Andreas Baumgarten
10 people are following this question.