add pipeline support to Get-BADUser

master
lub 5 months ago
parent 32c9c0e1e6
commit 92606775e3

@ -36,17 +36,22 @@ function prompt {
function Get-BADUser {
param (
[Parameter(Mandatory=$true,
Position=0)]
[string]
Position=0,
ValueFromPipeline)]
[string[]]
$SearchTerm,
[string]
$Server = $env:USERDNSDOMAIN+':3268'
)
$filter = 'UserPrincipalName -like "*{0}*" -or Name -like "*{0}*"' -f $SearchTerm
process {
foreach ($term in $SearchTerm) {
$filter = 'UserPrincipalName -like "*{0}*" -or Name -like "*{0}*"' -f $term
Get-ADUser -Filter $filter -Server $Server @args
Get-ADUser -Filter $filter -Server $Server @args
}
}
}
function Get-BADGroup {
param (

Loading…
Cancel
Save