ConvertTo-SecurityIdentifier

Converts a string or byte array security identifier into a System.Security.Principal.SecurityIdentifier object.

Syntax

ConvertTo-SecurityIdentifier [-SID] <Object> [<CommonParameters>]

Description

ConvertTo-SecurityIdentifier converts a SID in SDDL form (as a string), in binary form (as a byte array) into a System.Security.Principal.SecurityIdentifier object. It also accepts System.Security.Principal.SecurityIdentifier objects, and returns them back to you.

If the string or byte array don't represent a SID, an error is written and nothing is returned.

Related Commands

Parameters

Name Type Description Required? Pipeline Input Default Value
SID Object

The SID to convert to a System.Security.Principal.SecurityIdentifier. Accepts a SID in SDDL form as a string, a System.Security.Principal.SecurityIdentifier object, or a SID in binary form as an array of bytes.

true false

EXAMPLE 1

Resolve-Identity -SID 'S-1-5-21-2678556459-1010642102-471947008-1017'

Demonstrates how to convert a a SID in SDDL into a System.Security.Principal.SecurityIdentifier object.

EXAMPLE 2

Resolve-Identity -SID (New-Object 'Security.Principal.SecurityIdentifier' 'S-1-5-21-2678556459-1010642102-471947008-1017')

Demonstrates that you can pass a SecurityIdentifier object as the value of the SID parameter. The SID you passed in will be returned to you unchanged.

EXAMPLE 3

Resolve-Identity -SID $sidBytes

Demonstrates that you can use a byte array that represents a SID as the value of the SID parameter.