From 42854fb12805b05c1462ab1644c12fb4d579ca98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=B6rner=2C=20Simon?= Date: Thu, 8 Aug 2019 10:51:46 +0200 Subject: [PATCH] add initial Get-BetterADUser --- profile.ps1 | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/profile.ps1 b/profile.ps1 index a106057..4aa8776 100644 --- a/profile.ps1 +++ b/profile.ps1 @@ -19,7 +19,20 @@ function prompt { '[{0}@{1} {2}]{3} ' -f $env:USERNAME.ToLower(),$env:COMPUTERNAME.ToLower(),$cwd,$delimiter } +function Get-BetterADUser { + param ( + [Parameter(Mandatory=$true, + Position=0)] + [string] + $SearchTerm, + [string] + $Server = '{0}:3268' -f $env:USERDNSDOMAIN + ) + $filter = 'UserPrincipalName -like "*{0}*" -or Name -like "*{0}*"' -f $SearchTerm + + Get-ADUser -Filter $filter -Server $Server +} #check for old version