From 2c11cf741fe450a7102e16132662c114453be244 Mon Sep 17 00:00:00 2001 From: lub Date: Wed, 18 Jan 2023 11:07:18 +0100 Subject: [PATCH] implement Get-BADComputer --- profile.ps1 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/profile.ps1 b/profile.ps1 index 1f94771..fc8bfb2 100644 --- a/profile.ps1 +++ b/profile.ps1 @@ -57,6 +57,24 @@ function Get-BADGroup { Get-ADGroup -Filter $filter -Properties $Properties -Server $Server @args } +function Get-BADComputer { + param ( + [Parameter(Mandatory=$true, + Position=0)] + [string] + $SearchTerm, + + [string[]] + $Properties = @('Description','ManagedBy'), + + [string] + $Server = $env:USERDNSDOMAIN+':3268' + ) + + $filter = 'Name -like "*{0}*" -or Description -like "*{0}*"' -f $SearchTerm + + Get-ADComputer -Filter $filter -Properties $Properties -Server $Server @args +} function Get-Feierabend { param ( [Parameter(Position = 0)]