Udostępnij za pośrednictwem


Test-SCDomainCredential

Tests a credential or user name to verify that it authenticates in the domain.

Syntax

Credential

Test-SCDomainCredential
    [-Credential] <VMMCredential>
    [-VMMServer <ServerConnection>]
    [<CommonParameters>]

UserName

Test-SCDomainCredential
    [-UserName] <String>
    [-VMMServer <ServerConnection>]
    [<CommonParameters>]

Description

The Test-SCDomainCredential cmdlet tests a credential object or user name to verify that it authenticates in the domain.

Examples

Example 1: Test the validity of a credential object

PS C:\> $Creds = Get-Credential
PS C:\> Test-SCDomainCredential -Credential $Creds

The first command prompts you for a username and password, creates a PSCredential object, and stores the object in the $Creds variable.

The second command validates the credential object in $Creds and returns either True or False.

Example 2: Test the validity of a user name

PS C:\> Test-SCDomainCredential -UserName "PattiFuller"

This command tests the validity of the user name PattiFuller and returns either True or False.

Parameters

-Credential

Specifies a credential object or, for some cmdlets, a Run As account object that contains the user name and password of an account that has permission to perform this action. Or, in the case of Restart-SCJob, has permission to complete a restarted task.

For more information about the PSCredential object, type Get-Help Get-Credential.

For more information about Run As accounts, type Get-Help New-SCRunAsAccount.

Parameter properties

Type:VMMCredential
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Credential
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-UserName

Specifies a the name of a user. Enter a user name with the format Domain\User.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

UserName
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-VMMServer

Specifies a VMM server object.

Parameter properties

Type:ServerConnection
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Outputs

Boolean

This cmdlet returns a Boolean result.