< Back
ConvertTo-CSecurityIdentifier
Post
NAME ConvertTo-CSecurityIdentifier
SYNOPSIS
Converts a string or byte array security identifier into a `System.Security.Principal.SecurityIdentifier` object.
SYNTAX
ConvertTo-CSecurityIdentifier [-SID] <Object> [<CommonParameters>]
DESCRIPTION
`ConvertTo-CSecurityIdentifier` 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.
PARAMETERS
-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.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Resolve-CIdentity -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 --------------------------
PS C:\\>Resolve-CIdentity -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 --------------------------
PS C:\\>Resolve-CIdentity -SID $sidBytes
Demonstrates that you can use a byte array that represents a SID as the value of the `SID` parameter.
RELATED LINKS
Resolve-CIdentity
Resolve-CIdentityName
SYNOPSIS
Converts a string or byte array security identifier into a `System.Security.Principal.SecurityIdentifier` object.
SYNTAX
ConvertTo-CSecurityIdentifier [-SID] <Object> [<CommonParameters>]
DESCRIPTION
`ConvertTo-CSecurityIdentifier` 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.
PARAMETERS
-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.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Resolve-CIdentity -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 --------------------------
PS C:\\>Resolve-CIdentity -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 --------------------------
PS C:\\>Resolve-CIdentity -SID $sidBytes
Demonstrates that you can use a byte array that represents a SID as the value of the `SID` parameter.
RELATED LINKS
Resolve-CIdentity
Resolve-CIdentityName