Last active
March 31, 2016 01:45
-
-
Save Daenks/14fefd7df81a07309e07 to your computer and use it in GitHub Desktop.
Check haveibeenpwned.com's breach repository for an exchange 2007+ environment (requires PoweShell 3+ and Exchange Module Loaded)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-Mailbox -ResultSize Unlimited | ForEach-Object { } | |
$Mailboxes = Get-Mailbox -ResultSize Unlimited | |
$Results = @() | |
foreach ($mailbox in $Mailboxes) | |
{ | |
$s = $mailbox.PrimarySmtpAddress.ToString() -replace "@","%40" | |
$r = $null | |
$r = Invoke-WebRequest -URI "https://haveibeenpwned.com/api/v2/breachedaccount/$($s)" -Method GET -UserAgent "PsBreachFinder" -ErrorAction SilentlyContinue | |
if ($r -ne $null) | |
{ | |
$result = New-Object -TypeName PSObject | |
$result | Add-Member NoteProperty EmailAddress($($mailbox.PrimarySmtpAddress.ToString())) | |
$result | Add-Member NoteProperty Result($r) | |
$Results += $result | |
} | |
} | |
$Results | Format-Table -AutoSize |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment