Skip to content

Instantly share code, notes, and snippets.

@darrenjrobinson
Last active March 7, 2023 00:27
Show Gist options
  • Save darrenjrobinson/26c9ff551eeb35d790c624be0804171b to your computer and use it in GitHub Desktop.
Save darrenjrobinson/26c9ff551eeb35d790c624be0804171b to your computer and use it in GitHub Desktop.
Import LDIF File and Find Active Directory User
Function Get-LDIFUser {
[cmdletbinding()]
param(
[Parameter(Mandatory = $true, ValueFromPipeline = $true)]
[array]$LDIFObject,
[Parameter(Mandatory = $false, ValueFromPipeline = $true)]
[string]$employeeID
)
if ($LDIFObject.Count -gt 0) {
$result = $LDIFObject | Where-Object { $_.objectClass -eq 'user' -and $_.employeeId -eq $employeeID } | Select-Object
return $result
}
else {
"LDIFObject Array Empty. Nothing to search for with employee ID: '$($employeeID)'."
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment