Get-LocalUser [[-Name] <String[]>] [<CommonParameters>]
Get-LocalUser [[-SID] <SecurityIdentifier[]>] [<CommonParameters>]
The Get-LocalUser cmdlet gets local user accounts. This cmdlet gets default built-in user accounts, local user accounts that you created, and local accounts that you connected to Microsoft accounts.
-Name <String[]>
Specifies an array of names of user accounts that this cmdlet gets. You can use the wildcard character.
-SID <SecurityIdentifier[]>
Specifies an array of security IDs (SIDs) of user accounts that this cmdlet gets.
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,ErrorAction, ErrorVariable, WarningAction, WarningVariable,OutBuffer, PipelineVariable, and OutVariable.
PS C:\> Get-LocalUser -Name "AdminContoso02"
Name Enabled Description
---- ------- -----------
AdminContoso02 True Description of this account.
This command gets a user account named AdminContoso02.
PS C:\> Get-LocalUser -Name "MicrosoftAccount\username@Outlook.com"
Name Enabled Description
---- ------- -----------
MicrosoftAccount\user name@outlook.com True Description of this account.
This command gets a user account that is connected to a Microsoft account. This example uses a placeholder value for the user name of an account at Outlook.com.
PS C:\> Get-LocalUser -SecurityIdentifier "S-1-5-2"
Name Enabled Description
---- ------- -----------
MicrosoftAccount\user name@contoso.com True Description of this account.
This command gets a local user account that has the specified SID.
The PrincipalSource property is a property on LocalUser , LocalGroup , and LocalPrincipal * objects that describes the source of the object. The possible sources are as follows: - Local - Active Directory - Azure Active Directory group - Microsoft Account PrincipalSource is supported only by Windows 10, Windows Server 2016, and later versions of the Windows operating system. For earlier versions, the property is blank.
This work is licensed under a Creative Commons Attribution 4.0 International. It is attributed to Microsoft Corporation and can be found here.
PowerShell Commands