我想找一下纽约办事处IT部门的每个人。我如何组合这两个代码?我仅希望通过过滤属性而不是-searchbase来搜索用户。
Code 1:
get-aduser -filter "department -eq 'IT'" #get everyone from IT department
Code 2:
get-aduser -LDAPFilter "(PhysicalDeliveryOfficeName=NewYork)" #get everyone from NewYorkOffice
答案 0 :(得分:3)
您可以将过滤语句与布尔运算符组合使用:
get-aduser -filter {department -eq 'IT' -AND PhysicalDeliveryOfficeName -eq 'NewYork'} -Properies ('PhysicalDeliveryOfficeName', 'Department')