如何将交换属性同步到本地 AD 对象

how to sync an exchange attribute to on premise AD Object

我有几个用户具有自定义属性。 我想复制这些自定义属性的值并将它们添加到用户 AD 对象中的 ExtensionAttribute 属性。

到目前为止我已经尝试过:

 $CustomAttr1 = get-mailbox  $upn | Select CustomAttribute1
 Set-ADUser -server Server -identity Identity -Add @{ExtensionAttribute1=$CustomAttr1}

最终结果只是实际AD属性中的“@{$CustomAttribute1}”。

如何从 Exchange 中提取 'CustomAttribute1' 的字符串值并将其传递到 AD?

Select 将过滤生成的对象以具有单个 属性、CustomAttribute1。所以当你需要设置值时,你必须引用 属性 $CustomAttr1.CustomAttribute1 来获取值:

$CustomAttr1 = get-mailbox  $upn | Select CustomAttribute1
Set-ADUser -server Server -identity Identity -Add @{ExtensionAttribute1=$CustomAttr1.CustomAttribute1}