Get Local Users via API

Description

Gets a list of local users via the API.

Overview

Gets a list of local users along with the following information:

  • Enabled
  • Rid
  • UserType
  • Comment
  • PwdLastSet
  • LastLogon
  • NumLogins

Dependencies

  • None

Operating Systems

  • Windows

Example Output

ComputerName : localhost
UserName     : Administrator
Enabled      : False
Rid          : 500
UserType     : Administrator
Comment      : Built-in account for administering the computer/domain
PwdLastSet   : 1/1/1970 12:00:00 AM
LastLogon    : 1/1/1970 12:00:00 AM
NumLogins    : 0

ComputerName : localhost
UserName     : DefaultAccount
Enabled      : False
Rid          : 503
UserType     : Guest
Comment      : A user account managed by the system.
PwdLastSet   : 1/1/1970 12:00:00 AM
LastLogon    : 1/1/1970 12:00:00 AM
NumLogins    : 0

ComputerName : localhost
UserName     : Guest
Enabled      : False
Rid          : 501
UserType     : Guest
Comment      : Built-in account for guest access to the computer/domain
PwdLastSet   : 1/1/1970 12:00:00 AM
LastLogon    : 1/1/1970 12:00:00 AM
NumLogins    : 0

ComputerName : localhost
UserName     : helpdesk
Enabled      : True
Rid          : 1001
UserType     : Administrator
Comment      : 
PwdLastSet   : 3/10/2022 11:25:03 PM
LastLogon    : 10/12/2022 11:45:47 AM
NumLogins    : 9

ComputerName : localhost
UserName     : jason.bourne
Enabled      : True
Rid          : 1004
UserType     : Guest
Comment      : 
PwdLastSet   : 7/7/2022 12:58:23 PM
LastLogon    : 1/1/1970 12:00:00 AM
NumLogins    : 0

ComputerName : localhost
UserName     : WDAGUtilityAccount
Enabled      : False
Rid          : 504
UserType     : Guest
Comment      : A user account managed and used by the system for Windows Defender Application Guard scenarios.
PwdLastSet   : 3/10/2022 11:19:34 PM
LastLogon    : 1/1/1970 12:00:00 AM
NumLogins    : 0
Scroll to Top