Hi,
Have the users been created in an AD domain or as local accounts?
Gary.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
How can I run user count check manually in Windows Server 2019 so I can figure out the number of users?
What power shell command to list the users that user count check sees?
Hi,
Have the users been created in an AD domain or as local accounts?
Gary.
Hello Kd,
You can use:
For only Enabled User Accounts
(get-aduser -filter *|where {$_.enabled -eq "True"}).count
For only Disabled User Accounts
(get-aduser -filter *|where {$_.enabled -ne "False"}).count
Get-ADuser Reference: http://blogs.technet.com/b/heyscriptingguy/archive/2012/10/30/powertip-single-line-powershell-command-to-list-all-users-in-an-ou.aspx
--If the reply is helpful, please Upvote and Accept as answer--
I tried (get-aduser -filter *|where {$_.enabled -eq "True"}).count
but I found that some users do not have the Enabled attribute
so it is not showing correctly.
What might cause the missing attribute? How to put it back?
Hi @k d
Try this for enabled users, it uses a LDAP filter which will limit the records that are returned, reducing the time to complete query
(get-aduser -LDAPFilter '(!userAccountControl:1.2.840.113556.1.4.803:=2)').count
For disabled users count use this one
(get-aduser -LDAPFilter '(userAccountControl:1.2.840.113556.1.4.803:=2)').count
Gary.
When I looked at the attribute enabled via get-aduser -filter *|where {$_.enabled -eq "True"}, regular users do not have it, only administrators.