【发布时间】:2018-04-18 08:44:22
【问题描述】:
我正在使用下面的代码通过Get-ADComputer 获取 Active Directory 信息,它工作正常
$computersFilter= "(&(operatingSystem=*Windows 7*)(name=*-*)(!name=V7-*)(!name=*-none)(!name=*-oncall)(!name=*-blackbaud)(!name=sc-win7-1)(!name=ut-swclient-01))"
$computers= Get-ADComputer -LDAPFilter $computersFilter -Property LastLogonDate | Select-Object Name, OperatingSystem,LastLogonDate
$computers | Select Name, LastlogonDate, OperatingSystem | Export-Csv $ServiceTagsPath -NoTypeInformation
我还想检索操作系统高于 Windows 7(Windows 8、8.1 和 Windows 10)的计算机,但是当我像这样更改过滤器时:
(&(operatingSystem=*Windows 7*)(operatingSystem=*Windows 8*)(operatingSystem=*Windows 10*) ...
没有任何内容返回到 $computers 变量中
那么正确的方法是什么?
【问题讨论】:
标签: powershell scripting active-directory