ProxyAddresses
- это массив, поэтому -Like
не будет работать с этим.Это может помочь, если я правильно понимаю вопрос (не проверено)
$re = [regex]'ixi:\+49.*(\d{4})$'
Get-ADUser -Filter * -Properties ProxyAddresses |
Where-Object {$_.ProxyAddresses -match $re.toString()} |
Select-Object SamAccountName, ProxyAddresses,
@{Name = 'ixi'; Expression = {$re.Match($_.ProxyAddresses).Groups[1].Value}}
Детали регулярного выражения:
ixi: Match the characters “ixi:” literally
\+ Match the character “+” literally
49 Match the characters “49” literally
. Match any single character that is not a line break character
* Between zero and unlimited times, as many times as possible, giving back as needed (greedy)
( Match the regular expression below and capture its match into backreference number 1
\d Match a single digit 0..9
{4} Exactly 4 times
)
$ Assert position at the end of the string (or before the line break at the end of the string, if any)