I need to export some information from active directory. The current powershell script successfully get all the information it is asking for, but I want to also grab the user attribute "description" or "company."
$OUpath = 'OU=OU,DC=DC'
$ExportPath = 'C:\path\users_in_ou7.csv'
Get-ADUser -Filter * -SearchBase $OUpath | Select-object GivenName, Surname,Name,UserPrincipalName | Export-Csv -NoType $ExportPath
When I add either of those to the Select-object portion is turns up blank in my CSV. For example:
Select-object Description, Company, GivenName, Surname, Name, UserPrincipalName
Column headers are inserted into the CSV, but the values are blank. These attributes are populated in each of the user properties in AD. I am not sure if I am calling them correctly in my script. Any help would be appreiceiated. Thank you.