Tests that a name is a valid Windows local or domain user/group.
Test-Identity [-Name] <String> [-PassThru] [<CommonParameters>]
Uses the Windows LookupAccountName
function to find an identity. If it can't be found, returns $false
. Otherwise, it returns $true
.
Use the PassThru
switch to return a Carbon.Identity
object (instead of $true
if the identity exists.
Name | Type | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
Name | String | The name of the identity to test. |
true | false | |
PassThru | SwitchParameter | Returns a |
false | false | False |
Test-Identity -Name 'Administrators
Tests that a user or group called Administrators
exists on the local computer.
Test-Identity -Name 'CARBON\Testers'
Tests that a group called Testers
exists in the CARBON
domain.
Test-Identity -Name 'Tester' -PassThru
Tests that a user or group named Tester
exists and returns a System.Security.Principal.SecurityIdentifier
object if it does.