Код:
function Get-User{
param (
[string]$User,
[string]$OU
)
if ($OU) {Get-ADUser -Filter * -SearchBase "OU=$OU,DC=contoso,DC=com" | ft name, samaccountname, officephone}
if ($User) { Get-ADUser -Filter "samaccountname -like '*$User*' -or Name -like '*$User*'" -Properties * | FT name, samaccountname, officephone }
}
Возможно ли задавать OU не точно, а только часть букв?