We can get the description of Active Directory computers using the Get-AdComputer in PowerShell. AD computer has Description property.
We can get a description of the active directory computers using the Active Directory Users and Computers (ADUC) console snap-in interface and using the Get-AdComputer command in PowerShell.
In this article, we will discuss how to get ad computer description, how to get ad computers by description and find the computers in the active directory where the description contains search criteria.
Get Ad Computer Description using PowerShell
Using the Get-AdComputer in PowerShell, we can get ad computer description field information.
Get-AdComputer -Identity ENGG-PRO -Properties * | Select-Object Name, Description
In the above PowerShell script to get adcomputer with description, the Get-AdComputer uses the Identity parameter to get computer name. It pipes the ad computer object information. Select-Object cmdlet select name and description of ad computer and print it on the console.
We have used Properties * to get additional properties like the description field of the computer.
The output of the above PowerShell script to get the description of the ad computer is:
Get Description of AD Computers
Using the Get-AdComputer cmdlet in PowerShell, it can get one or more computers in the Active Directory.
Get-AdComputer -Filter * -Properties Name, Description | Select-Object Name,Description
In the above PowerShell script, the Get-AdComputer Filter * parameter is used to get ad computers with descriptions available in the active directory.
The output of the above script to display all ad computer description is:
PS C:\> Get-AdComputer -Filter * -Properties Name, Description | Select-Object Name,Description
Name Description
---- -----------
ENGG-PRO Zone-1 ENGG WorkStation
OPER-01 Zone-1 OPER Machine
OPER-2 Zone-2 OPER Machine
OPER-3 Zone-3 OPER Machine
CORP-IT-E12
PS C:\>
Get Ad Computer by Description using Filter
The Get-AdComputer Filter parameter uses the PowerShell Expression Language to write query strings for the active directory and search for computers in the active directory.
Get-AdComputer -Filter 'Description -like "Zone-1*"' -Properties * | Select-Object Name,Description
In the above PowerShell script, the Get-AdComputer Filter parameter uses query string to search for ad computer by a description like Zone-1*, it means Description stars with Zone-1.
It returns the list of ad computers where description like provided query in the script.
PowerShell Tip: How to Get Ad User Home Directory using PowerShell!
Find AdComputer where description is empty
Using the Get-AdComputer Filter parameter, we can get adcomputer having description empty.
Get-AdComputer -Filter {-not(Description -like "*") } -Properties Name, Description | Select Name,Description
In the above Script, Filter parameter check where adcomputer description like empty and select the name and description of the ad computers.
The output of the above script to get adcomputer, where the description is blank, is:
PS C:\> Get-AdComputer -Filter {-not(Description -like "*") } -Properties Name, Description | Select Name,Description
Name Description
---- -----------
CORP-IT-E12
PowerShell Tip: How to get ad computer operating system using PowerShell!
Get AD Computers Description from OU
Using the Get-AdComputer SearchBase parameter, it can search for ad computer objects within the specified OU and get a description of computers.
$OUPath = 'OU=SALES,DC=SHELLPRO,DC=LOCAL' Get-ADComputer -Filter * -SearchBase $OUPath -Properties * | Select Name, Description | Export-CSV -Path C:\PowerShell\adcomputers-description.csv -NoTypeInformation
In the above PowerShell script, the $OUPath variable contains the organizational unit path.
The Get-AdComputer uses the SearchBase parameter to search for computer objects within the specified OUpath and get ad computers with a description.
The Export-CSV cmdlet in PowerShell exports the list of adcomputers with their name and description to the CSV file.
PowerShell Tip: How to find computers from OU in Active Directory using PowerShell!
ADUC – Get Description of AD Computer
Active Directory Users and Computers console snap-in GUI tool provide a user interface to search for computer in the active directory and get a description of ad computer.
To get a description of ad computer using ADUC, follow the below steps:
- Open the ADUC console snap-in ( use the command dsa.msc in Run).
- Go to Action Menu and click on Find menu.
- It will open find dialog window to find ad objects like users, computers etc…
- Select the Computer in the first dropdown.
- Select the domain or organizational unit to limit the search to find the computer.
- Enter the computer name and click on Find Now button
- It will display the computer name list.
- Double click on the Computer name from the list. It will open AD computer properties dialog
- Check the Ad Computer Description Field
Conclusion
I hope the above article about how to get ad computer description and get a description of AD computers using the Get-AdComputer cmdlet in PowerShell is helpful.
You can also use ADUC to find the AD computer and check the Description field but it’s useful when you have to get the description for one computer. To get multiple ad computers description, use the Get-Adcomputer cmdlet.
You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page