This page is written by AI and proved by a human afterwards
TestCredential is a PowerShell module for interactively or programmatically verifying user credentials on Windows systems.
It is intended for scenarios where you want to check if a username and password are valid for the current machine or domain.
Note:
This module is Windows-only. It uses features not available on Linux or macOS.
- Interactive credential prompt (
Get-Credential) - Non-interactive mode for automation
- Pipeline support for credentials
- Multiple retry attempts for interactive mode
Prompts for credentials and checks them:
Test-CredentialPass a credential object (e.g., from Get-Credential):
$cred = Get-Credential
Test-Credential -Credentials $cred -NonInteractiveOr via pipeline:
Get-Credential | Test-Credentialif (Test-Credential) {
Write-Host "Credentials are valid."
} else {
Write-Host "Invalid credentials."
}- Windows only: Uses
Start-Job -Credential, which is not supported on Linux/macOS. - Does not test remote credentials or accounts not accessible to the local machine.
Copy the TestCredential module folder to a directory in your $env:PSModulePath, or import directly:
Import-Module 'Path\To\TestCredential'(c) 2025 Apteco GmbH. All rights reserved.