PowerShell 技能连载 - 设置 Active Directory 属性

需要 ActiveDirectory 模块

PowerShell 用哈希表来设置一个用户账户的 AD 属性这是一种多功能的指定任意键值对的方法。

这个简单的例子将设置用户“testuser”的“l”和“mail”属性。您可以向哈希表加入任意多的键值对,假设在您的 AD schema 中不存在该属性名,并且指定的数据类型是合法的:

$infos = @{}
$infos.l = 'Bahamas'
$infos.mail = 'sunny@offshore.com'

Set-ADUser -Identity testuser -Replace $infos

PowerShell 技能连载 - 设置 Active Directory 属性

https://blog.vichamp.com/2014/12/09/setting-active-directory-attributes/

作者

Victor Woo

发布于

2014-12-09

更新于

2014-12-09

许可协议

PowerShell 技术 QQ 群