在编写Powershell脚本以在AD用户和计算机>> OU >>通讯组中将扩展属性1值更改为“ Staff”时需要帮助吗?
您可以使用Get-ADUser和Set-ADUser进行此操作。阅读文档以了解更多信息,但常规语法为:
Get-ADUser -filter * -searchbase 'OU=SomeOU,DC=Contoso,DC=COM' | Set-ADUser -Replace @{extensionAttribute1='Staff'} -whatif
这将使-filter *
指定OU中的所有用户-searchbase 'OU=SomeOU,DC=Contoso,DC=COM'
通过管道将他们发送|
到set-aduser
extensionAttribute1设置为Staff的管道-Replace @{extensionAttribute1='Staff'}
。最后-whatif
用于显示在不实际影响任何更改的情况下会发生什么。这有助于确保语法正确。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句