所以我正在编写一个将由计划任务运行的批处理文件。此文件对 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/