Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Param
- (
- [Parameter(Mandatory=$true)] [string] $jsonfile
- , [Parameter(Mandatory=$true)] [string] $breachname
- , [Parameter(Mandatory=$false)] [switch] $PassUsersToPipeline
- )
- $json = Get-Content -Path $jsonfile | Convertfrom-Json
- foreach ($rec in $json.BreachSearchResults | ?{$_.Breaches.Title -eq $breachname} )
- {
- $mail = "{0}@{1}" -f $rec.alias,$rec.domainname
- $mailFilter = "smtp:{0}" -f $mail
- $user = Get-ADUser -Filter {ProxyAddresses -eq $mailFilter} -Properties displayname
- if($PassUsersToPipeline)
- {
- $user
- }
- else
- {
- [pscustomobject] @{
- mail = $mail
- displayName = $user.displayName
- status = $user.Enabled
- }
- }
- }
Add Comment
Please, Sign In to add comment