Get-User cmdlet gets the information about AD user(s).

Input parameters  

#
Parameter
Type

Mandatory (R/O)

Description
Valid Values
1 Authentication information (all parameters)  
2

Count

int O

The number of the returned items (after Offset parameter is specified and processed)

Min value is 1, max - 1000.

If not specified, equals to 100 (the default value).

3

Identity

(aliases: GUID, DistinguishedName, UserPrincipalName, Name)

UserIDParameter O

A property, that is used for managing the user


Value of one of these parameters can be used as Identity:

#ParameterDescription
1 GUID Globally Unique Identifier (ObjectGuid)
2 DistinguishedName Unique name of the object in Active Directory
3 UserPrincipalName Primary Email address (Login)
4 Name Internal name of the AD object (User)
4 Offset int O A number of the item, starting from which the items should be returned

Min value is 1.

If not specified, equals to 1 (the default value)

5

SortBy

string O This parameter allows to sort the list by the field (property). The values of the specified field are sorted in ascending order  

Type UserIDParameter

This type is used for implicit converting strings, GUIDs or ADObjectIDInfo for identifiers, acceptable to Control Panel. It also supports wildcard ( * ) for searching by mask. UserIDParameter doesn't have any properties (parameters) as such. The user must not construct objects of this type by himself.

Output parameters  

UserInfo

Examples of using Get-User cmdlet

Displaying list of users for the account configured via Set-ConnectionSettings:

Get-User

Get-User search based on UserPrincipalName:

Get-User *test*

Get-User search based on GUID:

#when creating automation scripts, prefer using GUID or DistinguishedName as identity for users to avoid any ambiguous results

Get-User 'd5610fa4-57b8-4c3a-aadb-f7a5b83fbd75'

Displaying list of users for a particular account using AccountID:

Get-User -AccountID 1234567

Displaying 10 users, starting from the third one:

Get-User -Offset 3 -Count 10

Displaying all users in a sortable grid:

Get-User | Out-GridView

Export of all users into a CSV-file:

Get-User | Export-Csv c:\path\users.csv