我想要使用PowerShell在AD用戶描述字段中獲得以特定關鍵字開頭的所有用戶。 關鍵字:無法執行的PowerShell在AD的描述字段中獲取具有特定關鍵字的AD用戶
Import-Module ActiveDirectory
Get-ADUser -Filter * -SearchBase 'OU=contoso, DC=contoso, DC=local' - Properties Description | select -expand name,distinguishedname,description | Export-Csv -path C:\description.csv -NoTypeInformation
最後更新:
Get-ADUser -Properties Description -Filter 'Description -like "*Could not execute powershell*"' -SearchBase 'OU=contoso, DC=contoso, DC=local' |
select name,distinguishedname,description |
Export-Csv -path C:\description2.csv -NoTypeInformation
我得到了像Get-ADUser這樣的錯誤:無法綁定參數,因爲參數'Filter'被多次指定。要爲可以接受多個值的參數提供多個值,請使用數組syn syn tax。例如,「參數value1,value2,value3」。 – Arbelac
@Arbelac看到我的更新,如果需要添加您的搜索庫。 – Jakodns
像你說的那樣很好 – Arbelac