ivan rosa
asked on
Adding a filter to a property
Hi Folks,
i have wrote this line here to get a count of all users from an OU
however i'm also trying to add a filter where it would only select active users... this line here i know will pick this specifici object but I don't know how to tell it just to pick the ones that are active
does anybody have any idea on how to accompllish it?
thanks for looking
i have wrote this line here to get a count of all users from an OU
(Get-ADUser -Filter "objectcategory -eq 'user'" -SearchBase "OU=microsoft=com").count
however i'm also trying to add a filter where it would only select active users... this line here i know will pick this specifici object but I don't know how to tell it just to pick the ones that are active
(Get-ADUser -Filter "objectcategory -eq 'user'" -SearchBase "ou=microsoft=com" -properties * | select-object enabled).count
does anybody have any idea on how to accompllish it?
thanks for looking
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Makes sense, thanks bud!
Glad to help.
Open in new window
The "objectcategory -eq 'user'" is redundant, since we're using the Get-ADUser cmdlet.