Public/Get-HibpBreachedDomain.ps1
function Get-HibpBreachedDomain { <# .SYNOPSIS Gets all breached accounts for a specific domain. .DESCRIPTION Retrieves a list of all accounts that have been pwned in a breach for a specific domain. This is a premium feature and requires a subscription. .PARAMETER Domain The domain to search for (e.g., 'example.com'). This parameter is required. .PARAMETER ApiKey Your HIBP API key. Can be used instead of saving the key with Save-HibpCredential. .EXAMPLE Get-HibpBreachedDomain -Domain 'example.com' Returns all breached accounts for the domain 'example.com'. .LINK https://haveibeenpwned.com/API/v3#BreachesForDomain #> [CmdletBinding()] Param( [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline)] [string]$Domain, [string]$ApiKey ) process { $endpoint = 'breacheddomain/{0}' -f $Domain $invokeParams = @{ Endpoint = $endpoint } if ($PSBoundParameters.ContainsKey('ApiKey')) { $invokeParams.ApiKey = $ApiKey } Invoke-HibpRequest @invokeParams } } |