AD Powershell脚本 [英] AD Powershell script

查看:100
本文介绍了AD Powershell脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Guys,

Hello Guys,

我研究一个脚本,将AD计算机从txt文件移动到另一个OU,并为每台机器禁用该帐户。

I research a script to move AD Computer from a txt file to a different OU and for each machine disable the account.

我最后还想要一个定义所有不同结果的日志文件。

Also I want finally a logfile that define all the different result.

提前谢谢你,

推荐答案

Hello Francois,

Hello Francois,

这很简单,您可以使用Get从文本文件中读取计算机名称-Content,使用Move-ADObject移动计算机帐户,并使用Disable-ADAccount禁用该帐户。有关这些cmdlet的详细信息,请查看此处:

That is fairly simple, you can read the computer names from the text file using Get-Content, move the computer account using Move-ADObject and disable the account using Disable-ADAccount. For more information about these cmdlets have a look over here:

https ://technet.microsoft.com/en-us/library/hh849787.aspx


https://technet.microsoft.com/en-us/library/ee617248.aspx


https://technet.microsoft.com/en-us/library/ee617197.aspx

你会结束代码有点像这样:

You would end up with code somewhat like this:

Get-Content YourFile.txt | ForEach-Object {


ComputerAccount = Get-ADObject
ComputerAccount = Get-ADObject


_


这篇关于AD Powershell脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆