Get-User

Gets local users.

Syntax

Get-User [[-UserName] <String>] [<CommonParameters>]

Description

Get-User gets all local users. Use the UserName parameter to get a specific user by its username.

The objects returned by Get-User are instances of System.DirectoryServices.AccountManagement.UserPrincipal. These objects use external resources, which, if they are disposed of correctly, will cause memory leaks. When you're done using the objects returne by Get-User, call Dispose() on each one to clean up its external resources.

Get-User is new in Carbon 2.0.

Related Commands

Parameters

Name Type Description Required? Pipeline Input Default Value
UserName String

The username for the user.

false false

Return Values

System.DirectoryServices.AccountManagement.UserPrincipal.

EXAMPLE 1

Get-User

Demonstrates how to get all local users.

EXAMPLE 2

Get-User -Username LSkywalker

Demonstrates how to get a specific user.