active-directory - 将逗号添加到 dsquery 输出

标签 active-directory dsquery

所以我正在编写一个将由计划任务运行的批处理文件。此文件对 AD 中用户的某些属性执行 DSQuery。

这是我的查询:

dsquery user ou=org_unit,dc=company,dc=local -name * -limit 0 | dsget user -dn -email -tel >a.txt

所以我的问题是如何用逗号分隔输出?它在文本文件中以漂亮的列显示,但它将被其他东西解析以输入数据库,并且解析规则依赖于逗号。

我需要转动这个:

CN=USER NAME,OU=ORG_UNIT,OU=ANOTHER_ORG_UNIT,DC=DOMAINROOT,DC=LOCAL (111)111-1111 <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6d08000c04012d08000c0401430e0200" rel="noreferrer noopener nofollow">[email protected]</a>

进入此:

CN=USER NAME,OU=ORG_UNIT,OU=ANOTHER_ORG_UNIT,DC=DOMAINROOT,DC=LOCAL, (111)111-1111,  <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b9dcd4d8d0d5f9dcd4d8d0d597dad6d4" rel="noreferrer noopener nofollow">[email protected]</a>

那么如何编辑我的查询以使其输出我需要的内容,如图所示?还有其他我可以运行的东西可以帮我做到这一点吗?

最佳答案

没关系。找出一个 CSVDE 查询来运行它。

csvde -m -f test.txt -d "ou=org_unit,dc=domainroot,dc=local" -r objectCategory=Person -l mail,telephoneNumber

以我需要的格式返回我需要的内容。

关于active-directory - 将逗号添加到 dsquery 输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12957589/

相关文章:

java - 通过 Waffle (Java) 获取具有经过身份验证的身份的 Active Directory 用户列表?

database - 为文件共享和从教室向所有学生分发文件找出一个长期的解决方案

powershell - 打开文件查询以查看打开的文件

java - 使用 Java 检测登录计算机的用户

javascript - 如何在 .NET 或 JavaScript 中使用 MS-XCEP 和 MS-WSTEP 从 AD CS 获取证书?

powershell - 批量使用 ActiveDirectory cmdlet 时出现 Active Directory transient 错误

linux - 从 Windows 或 Linux 设备使用 Python 2.7 查询 Windows Active Directory

powershell - Active Directory 引用跟踪问题

powershell - Get-ADGroup 返回与 dsquery 不同的 ObjectGUID