Skip to content

Test-ADCredential

SYNOPSIS

Validates Active Directory credentials.

SYNTAX

Test-ADCredential [[-Credential] <Object>]

DESCRIPTION

The `Test-ADCredential` function validates the provided Active Directory credentials by attempting to authenticate against the domain. It uses the `System.DirectoryServices.AccountManagement` namespace to perform the validation and supports credentials with or without a specified domain.

EXAMPLES

EXAMPLE 1

Test-ADCredential -Credential (Get-Credential)

Validates the provided credentials against the Active Directory domain.

EXAMPLE 2

$cred = Get-Credential; Test-ADCredential -Credential $cred

Stores the credentials in a variable and validates them against the Active Directory domain.

PARAMETERS

-Credential

The credential to validate. If no domain is specified, the current user's domain is used.

Type: Object
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

INPUTS

OUTPUTS

NOTES