AD用户文件夹清理批处理脚本
我有一个批处理文件,我一直在尝试创建该文件,该文件将读取两个 csv 文件,对它们进行比较并根据差异执行操作。第一个文件是广告用户列表,第二个文件是我们 nas 上的广告用户文件夹列表。
我想要一个批处理文件来比较它们,如果有广告用户没有文件夹,请创建该文件夹。如果存在没有用户的文件夹,请删除该文件夹。但我也希望能够在让它执行操作之前看到比较结果,以确保一切正确。
IE
广告用户文件
<前><代码>汤姆 山姆 乔治 莎莉文件夹文件
<前><代码>汤姆 乔治 莎莉 账单
Sam 没有文件夹,所以创建它,Bill 有一个文件夹,但没有用户,所以删除它。
I have a batch file I have been trying to create that would read two csv files compare them and do an action based on the differences. First file is a list of ad users and second file is a list of ad user folders on our nas.
I would like a batch file that would compare them and if there is a ad user that does not have a folder, create the folder. If there is a folder that does not have a user delete the folder. But I also would like to be able to see the results of the comparison before I let it perform the actions to make sure all is correct.
I.E.
ad user file
Tom Sam George Sally
folder file
Tom George Sally Bill
There is no folder for Sam so create it, and there is a folder for Bill but no user so delete it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果不能立即解决问题,这样的事情至少可以作为一个好的起点:
Something like this might at least serve as a good starting point, if not immediately solve the problem: