I am trying to find all groups in Active Directory that contain the word "Dedicated" in the description...
Currently I have the following code:
Get-ADgroup -filter {GroupCategory -eq "Security" -and Description -like "*Dedicated*"} | Select-object Name, description
I keep getting the following error:
This operation returned because the timeout period expired
Can anyone help me with my query to return a list of all these groups with their descriptions?
答案 0 :(得分:1)
如果目录中有许多对象,则对非索引属性(如description
)的子字符串搜索可能会非常慢。
您可以执行的操作是检索具有说明的所有组,并使用Where-Object
对客户端进行过滤。
请注意,Get-ADGroup
默认情况下不会返回description
值,您需要使用-Properties
参数指定该值:
Get-ADgroup -filter {GroupCategory -eq "Security" -and Description -like "*"} -Properties Description |Where-Object {$_.Description -like "*dedicated*"} |Select-Object Name,Description