Run User Count Check

k d 16 Reputation points
2021-10-12T16:26:08.777+00:00

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?

Windows for business Windows Server User experience PowerShell
0 comments No comments
{count} votes

9 answers

Sort by: Most helpful
  1. Gary Reynolds 9,621 Reputation points
    2021-10-13T06:29:58.443+00:00

    Hi,

    Have the users been created in an AD domain or as local accounts?

    Gary.

    0 comments No comments

  2. Limitless Technology 39,916 Reputation points
    2021-10-13T08:49:47.4+00:00

    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--

    0 comments No comments

  3. k d 16 Reputation points
    2021-10-14T01:19:01.23+00:00

    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?

    0 comments No comments

  4. Gary Reynolds 9,621 Reputation points
    2021-10-14T08:11:47.947+00:00

    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.

    0 comments No comments

  5. k d 16 Reputation points
    2021-10-14T19:40:27.36+00:00

    When I looked at the attribute enabled via get-aduser -filter *|where {$_.enabled -eq "True"}, regular users do not have it, only administrators.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.