我想知道是否有辦法在我運行時過濾proxyadresses下的結果:
$Users = Get-AzureADUser -All:$true | Select-Object DisplayName, mail, @{n="ProxyAddresses";e={$_.ProxyAddresses -join "`r`n"}}
結果有點像這個atm..
DisplayName Mail ProxyAddresses
----------- ---- --------------
name1 name1@email.com smtp:name1@email.com
name2 name2@email.com SMTP:name2@email.com, SMTP:admin@email.com, smtp:name2@email.com.onmicrosoft.com...
name3 name3@email.com smtp:name@email.com.onmicrosoft.com...
然后我將其繪制到 hudu 中的 html 表中。atm 這作業正常。但如果有辦法從那里排除“onmicrosoft”地址,我希望它。我不想使用,
| Where-Object { $_.ProxyAddresses -notmatch "onmicrosoft" }
因為這只會洗掉別名中的每個用戶。
是否有可能以-replace某種方式做一個,然后用一個空字串替換它?
如果對此有任何幫助,我將非常高興!:)
uj5u.com熱心網友回復:
感謝
替換為以下代碼以獲取用戶排除 .onmicrosoft.com
$Users = Get-AzureADUser -All:$true | Select-Object DisplayName, mail, @{n="ProxyAddresses";e={($_.ProxyAddresses | Where-Object {$_ -notmatch 'onmicrosoft'}) -join "rn"}}

轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/349108.html
