Hi @Billvel ,
the command Get-AdUser
should be helpful to get all users of OU:
https://learn.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