daily pastebin goal
72%
SHARE
TWEET

Untitled

a guest Jan 18th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Param
  2. (
  3.       [Parameter(Mandatory=$true)]   [string] $jsonfile
  4.     , [Parameter(Mandatory=$true)]   [string] $breachname
  5.     , [Parameter(Mandatory=$false)]   [switch] $PassUsersToPipeline
  6. )
  7.  
  8.  
  9. $json = Get-Content -Path $jsonfile | Convertfrom-Json
  10.  
  11. foreach ($rec in $json.BreachSearchResults | ?{$_.Breaches.Title -eq $breachname} )
  12. {
  13.     $mail = "{0}@{1}" -f $rec.alias,$rec.domainname
  14.     $mailFilter = "smtp:{0}" -f $mail
  15.  
  16.     $user = Get-ADUser -Filter {ProxyAddresses -eq $mailFilter} -Properties displayname
  17.  
  18.     if($PassUsersToPipeline)
  19.     {
  20.         $user
  21.     }
  22.     else
  23.     {
  24.         [pscustomobject] @{
  25.             mail = $mail
  26.             displayName = $user.displayName
  27.             status = $user.Enabled
  28.         }
  29.     }
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top