Home » PowerShell » Get-AdUser Title using PowerShell

Get-AdUser Title using PowerShell

Using the Get-Aduser Title property in PowerShell, the Active Directory user title can be easily retrieved. Active Directory user has Job Title property where it stores the ad user job title and department.

Get-AdUser cmdlet retrieves the default set of properties. Title and Department properties are not available in the default set of properties.

Specify the property name comma separated with the -Properties parameter to retrieve aduser properties.

If you don’t specify properties name, it will display the job title as empty and the department as empty.

You can also use Get-AdUser -Properties * parameter to retrieve additional properties.

In this article, we will discuss how to use the Get-AdUser cmdlet in PowerShell to get ad user title, department, and get aduser title and export it to a CSV file.

Let’s practice the get-aduser title with examples.

Get-AdUser Title and Department

Using the Get-AdUser in PowerShell, you can get aduser title and department from the active directory organizational unit.

Get-AdUser -Identity "AronS" -Properties Title | Select-Object Title,GivenName,DistinguishedName

In the above PowerShell script, the Get-Aduser gets the ad user job title specified by the Identity parameter.

Get-AdUser Title property specified with -Properties parameter to retrieve job tile and using the Select-Object Title displays it on the console.

The output of the script displays the active directory user Title as HR Manager.

Get-AdUser Title
Get-AdUser Title

Get Ad Users Filter Title Like

Using the Get-AdUser Filter parameter, specify Title like query to get active directory user title that matches with specified search criteria. It gets ad users by Title.

 Get-AdUser -Filter 'Title -like "Lead HR"' -Properties * -SearchBase "OU=HR,DC=SHELLPRO,DC=LOCAL" | Select-Object Title,GivenName,DistinguishedName,Department

Filter parameter in the Get-AdUser cmdlet uses the PowerShell Expression languages to write the query.

In the above example to get aduser title like ‘Lead HR’ is specified in the Filter parameter and search adusers in the organizational unit specified in the -SearchBase parameter.

The output of the above script gets ad users where the Job Title contains Lead HR and department as Human Resource.

Get-AdUser by Title
Get-AdUser by Title
PS C:\> Get-AdUser -Filter 'Title -like "Lead HR"' -Properties * -SearchBase "OU=HR,DC=SHELLPRO,DC=LOCAL" | Select-Object Title,GivenName,DistinguishedName,Department

Title   GivenName DistinguishedName                         Department
-----   --------- -----------------                         ----------
Lead HR Erick     CN=Erick Jones,OU=HR,DC=SHELLPRO,DC=LOCAL Human Resource
Lead HR Gary      CN=Gary Willy,OU=HR,DC=SHELLPRO,DC=LOCAL  Human Resource


PS C:\>

Get Active Directory User Title from OU and Export to CSV

Use the Get-AdUser in PowerShell to get the active directory user’s Job Title, Department from the OU, and export the adusers to the CSV file.

Get-ADUser -Filter 'enabled -eq $true' -Properties * -SearchBase "OU=HR,DC=SHELLPRO,DC=LOCAL" |Select-Object GivenName,Title,Department | Export-Csv -Path C:\PowerShell\ADUserJobTitle.csv -NoTypeInformation

In the above PowerShell script, the Get-AdUser uses the Filter parameter to filter users who are enabled in the Active Directory and search within a specified organizational unit.

Select-Object cmdlet select aduser Job Title, Department, and GivenName.

It passes it to the Export-CSV cmdlet to export the list of aduser with their Title, and Department to a CSV file.

Cool Tip: How to use Get-AdOrganizationalUnit in the Active Directory!

Conclusion

I hope the above article on Get-AdUser Title and Department is helpful to you.

Specify Title and Department properties in the Get-AdUser -Properties parameter to retrieve adusers job titles and other properties. If you don’t specify, the aduser job title will be empty.

Cool Tip: How to get Aduser SAMAccountName from distinguishedName in PowerShell!

You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.