windows - 让 AD 用户在 AD 的描述字段中具有特定关键字

标签 windows powershell active-directory

我想使用 PowerShell 让所有这些用户以 AD 用户描述字段中的特定关键字开头。 关键字:无法执行 powershell

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 选项,这是一项简单的任务。

有关如何过滤的更多信息:https://technet.microsoft.com/en-us/library/ee617241.aspx?f=255&MSPPError=-2147217396

过滤位下

 Get-ADUser -Properties Description -Filter {Description -like $Description} -SearchBase 'OU=contoso, DC=contoso, DC=local' | select Name, DistinguishedName, Description | Export-Csv -path C:\description2.csv -NoTypeInformation

关于windows - 让 AD 用户在 AD 的描述字段中具有特定关键字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39077830/

相关文章:

windows - 当我的 Windows .bat 被调用时,ECHO 是打开还是关闭?

excel - powershell 无法向 Excel 图表添加多个图例条目(系列)

powershell - 如何分隔规范名称数组?

PowerShell 脚本写成一长行 - 自动格式化?

.net - 在.Net中,有没有办法让 [System.IO.File]::ReadAllLines($file) 读取部分锁定的文件?

c# - 事件目录 : Query Performance

c# - 如何确保 IsInRole 检查不使用缓存的凭据

windows - 通过CMD自动重启无响应程序

python-3.x - python pyinstaller 未找到名为 "cairo"的库

android - java.net.UnknownHostException : Unable to resolve host [LOCAL]