2
我想搜索特定電話號碼/分機的Active Directory用戶的所有屬性。Powershell:Where-Object通配符
我可以得到所有的屬性,像這樣:
get-aduser joesmith -Properties *
,但我要篩選的結果,說分機1234(可在很多地方,如extensionAttribute1,OfficePhone,HOMEPHONE,手機等)。
我想:
get-aduser joesmith -Properties * | where-object {$_ -like "*1234*" }
但如果對象要$ _值,我不知道的精確值。
如何搜索多個屬性的值?我希望看到這樣的結果:
mobile 1234
officephone 12345
othermobile 61234
或者,您可以使用Get-Member,例如:'get-aduser joesmith -prop * | gm -MemberType Property | select -ExpandProperty name |%{if($ test。$ _ -match「@philips」){[pscustomobject ] @ {Name = $ _; Value = $ test。$ _}}}'...這可能會讓您更容易使用。 – TheMadTechnician