Let's perform the following steps:
- First of all, try to retrieve just one single user. This operation is very quick, as shown in the following example:
Get-ADUser -Identity install
- But now watch what happens when, instead, you filter with Where-Object, as shown in the following example:
Get-ADUser -Filter * | Where-Object -Property SamAccountName -eq install
- Often, you already know which OU you want to look in. To speed up processing, you can specify the OU as the search base for your cmdlet, as follows:
Get-ADUser -Filter * -SearchBase $orgUnit -SearchScope Subtree
- In countless examples on the internet, you will find LDAP filters being used. While this recipe will not cover those, you can try a comparatively simple ...