Active Directory is a directory service that stores information about users, computers, and other objects in the Windows network. Using the Get-AdUser cmdlet in PowerShell, you can get active directory user information, including their company name.
The `Get-AdUser
` command in PowerShell is used to get information about users in the Active Directory. It has Company
property that contains the company name of the user.
The following PowerShell script will get the aduser company name.
Get-AdUser -Identity arons -Properties * | Select-Object -Property Company
In the above PowerShell script, the Get-Aduser command uses the Identity
parameter to specify the user whose information you want to retrieve, in this case user is named “arons”. The -Properties *
parameter specifies the properties that you want to retrieve, in this case, the Company
property.
The Select-Object
cmdlet is used to select the specific properties of an aduser object. The -Property
parameter specifies the properties that you want to select.
The output of the above PowerShell script prints the company name of the user to the console.
Cool Tip: How to get the aduser department name in PowerShell!
Conclusion
I hope the above article on how to retrieve the get aduser company name using the PowerShell Get-AdUser cmdlet is helpful to you.
The Properties *
parameter is used to retrieve all the properties of the user object.
You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.