Managing Local Users

by Jan 13, 2017

PowerShell 5.1 finally ships with cmdlets to manage local user accounts. To get a list of local user accounts, use Get-LocalUser and pipe the result to Select-Object to see all properties:

 
PS C:\> Get-LocalUser | Select-Object -Property *


AccountExpires         : 
Description            : Predefined Account to manage computer or domain
Enabled                : False
FullName               : 
PasswordChangeableDate : 
PasswordExpires        : 
UserMayChangePassword  : True
PasswordRequired       : True
PasswordLastSet        : 7/10/2015 2:22:01 PM
LastLogon              : 12/8/2015 5:44:47 AM
Name                   : Administrator
SID                    : S-1-5-21-2012478179-265285931-690539891-500
PrincipalSource        : Local
ObjectClass            : User

AccountExpires         : 
Description            : User Account managed by system
Enabled                : False
FullName               : 
PasswordChangeableDate : 
PasswordExpires        : 
UserMayChangePassword  : True
PasswordRequired       : False
PasswordLastSet        : 
LastLogon              : 
Name                   : DefaultAccount
SID                    : S-1-5-21-2012478179-265285931-690539891-503
PrincipalSource        : Local
ObjectClass            : User

AccountExpires         : 
Description            : Predefined Account for Guest access
Enabled                : False
FullName               : 
PasswordChangeableDate : 
PasswordExpires        : 
UserMayChangePassword  : False
PasswordRequired       : False
PasswordLastSet        : 
LastLogon              : 
Name                   : Guest
SID                    : S-1-5-21-2012478179-265285931-690539891-501
PrincipalSource        : Local
ObjectClass            : User
...
 

Twitter This Tip! ReTweet this Tip!