Test-ADUserPassword
SYNOPSIS
Validates the password for one or more Active Directory users.
SYNTAX
Test-ADUserPassword [-Identity] <String[]> [-Password] <String> [[-Domain] <String>] [-WhatIf] [-Confirm]
[<CommonParameters>]
DESCRIPTION
The `Test-ADUserPassword` function checks if the provided password matches the password of one or more specified Active Directory users. It validates the user's account status, including whether the account is enabled, locked out, or expired, and attempts to authenticate using the provided password.
EXAMPLES
EXAMPLE 1
Validates if the password "P@ssw0rd" matches the account for the user "jdoe."
EXAMPLE 2
Validates if the password "P@ssw0rd" matches the accounts for the users "jdoe" and "asmith" in the "example.com" domain.
PARAMETERS
-Identity
One or more identities of the Active Directory users to validate (e.g., DistinguishedName, SamAccountName).
Type: String[]
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
-Password
The password to validate against the specified users.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Domain
The domain to query for the user accounts. Defaults to the current user's domain.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: $env:USERDNSDOMAIN
Accept pipeline input: False
Accept wildcard characters: False
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Confirm
Prompts you for confirmation before running the cmdlet.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.