【发布时间】:2020-08-04 16:11:06
【问题描述】:
我正在尝试从 AD 获取计算机列表,不包括一些不再使用的计算机。 这是我的代码:
$ServerList = Get-ADComputer -Filter * | Where {
$_.DistinguishedName -like "*Computers*" -and $_.DistinguishedName -notlike @("*server1*","*Server2*")
} | Select-Object Name
我正在尝试将要排除的计算机放入数组中,而不是使用
-and $_.DistinguishedName -notlike "*serverIwantToExclude*"
你们能告诉我如何修改它吗?
【问题讨论】:
标签: windows powershell active-directory