Test-ElysiumPasswordQuality and Send-ElysiumHashExport only worked interactively: a Read-Host for the domain number and a credential prompt, so nothing could run unattended. - Both cmdlets take -Domain (a configured DomainNName, matched case-insensitively) and -Credential. Omitted, they prompt exactly as before; a supplied credential still goes through the same Get-ADDomain / replication-permission pre-checks. - The root wrappers take -Domain only and forward it through the Windows PowerShell relaunch; a PSCredential cannot be passed on a powershell.exe command line, so non-interactive credentials go through the cmdlets. - The two copies of the domain prompt become Select-ElysiumDomain in Private/Settings.ps1. An unknown name fails listing the configured domains; a domain without a DC fails before any credential prompt (the export previously only noticed later). Verified: unit test for by-name (case-insensitive), unknown name, missing DC, and the prompt path with Read-Host mocked (valid and invalid number); with a fake powershell.exe on PATH both wrappers relaunch with "-Domain contoso.local" intact; 32/32 Pester tests pass on this commit's tree. The AD paths need the Windows run.
41 lines
1.8 KiB
PowerShell
41 lines
1.8 KiB
PowerShell
##################################################
|
|
## ____ ___ ____ _____ _ _ _____ _____ ##
|
|
## / ___/ _ \| _ \| ____| | \ | | ____|_ _| ##
|
|
## | | | | | | |_) | _| | \| | _| | | ##
|
|
## | |__| |_| | _ <| |___ _| |\ | |___ | | ##
|
|
## \____\__\_\_| \_\_____(_)_| \_|_____| |_| ##
|
|
## Move fast and fix things. ##
|
|
##################################################
|
|
## Project: Elysium ##
|
|
## File: Test-WeakADPasswords.ps1 ##
|
|
## Support: support@cqre.net ##
|
|
##################################################
|
|
|
|
<#
|
|
.SYNOPSIS
|
|
Weak AD password finder component of Elysium tool.
|
|
|
|
.DESCRIPTION
|
|
This script will test the passwords of selected domain (defined in ElysiumSettings.txt) using DSInternals' Test-PasswordQuality cmdlet. It writes its output to a report file which is meant to be shared with the internal security team. The report now includes UPNs for each account mentioned.
|
|
|
|
Thin wrapper around the Test-ElysiumPasswordQuality cmdlet in src/Elysium, kept so existing
|
|
invocations and the menu keep working.
|
|
|
|
.PARAMETER Domain
|
|
Name of a configured domain (DomainNName in ElysiumSettings.txt). Omit to choose interactively.
|
|
#>
|
|
|
|
[CmdletBinding()]
|
|
param([string]$Domain)
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
Set-StrictMode -Version Latest
|
|
|
|
# DSInternals/ActiveDirectory need Windows PowerShell; relaunch there when started from pwsh.
|
|
. (Join-Path -Path $PSScriptRoot -ChildPath 'src/Elysium/Private/Relaunch.ps1')
|
|
Restart-WithWindowsPowerShellIfAvailable -BoundParameters $PSBoundParameters -UnboundArguments $MyInvocation.UnboundArguments
|
|
|
|
Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath 'src/Elysium/Elysium.psd1') -Force
|
|
Test-ElysiumPasswordQuality @PSBoundParameters
|
|
Write-Host "Script execution completed."
|