Filtering Enabled only Get-ADObject to with specific patterns and OU?
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Filtering Enabled only Get-ADObject to with specific patterns and OU?
You asked this same question in another forum. The answer given gave you the steps to diagnosing why you were not getting any results. Have you done what was requested. Do you get result when retrieving without the "Where" filter?
Re: Filtering Enabled only Get-ADObject to with specific patterns and OU?
I'd use an ldapfilter
The above will get enabled user and computer accounts.
Cheers
David
Code: Select all
get-adobject -LDAPFilter '(&(objectclass=user)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))'
Cheers
David
Re: Filtering Enabled only Get-ADObject to with specific patterns and OU?
That is what he asked before and the answer was given. The answer does not produce results.Lembasts wrote: ↑Thu Sep 03, 2020 10:46 pmI'd use an ldapfilterThe above will get enabled user and computer accounts.Code: Select all
get-adobject -LDAPFilter '(&(objectclass=user)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))'
Cheers
David
User account control will not work in this case and the query will not produce the desired results.
Re: Filtering Enabled only Get-ADObject to with specific patterns and OU?
I use useraccountcontrol all the time and it works fine.