首页 > 解决方案 > 如何使用powershell在Notes字段中附加文本

问题描述

我正在尝试Notes使用以下脚本更新字段

Set-Group -Identity "DLName" -Notes "Comment" -ErrorAction Stop

如果上面的脚本已经有任何内容,则替换它的内容。Notes我想在备注字段中追加新数据。请帮我解决一下这个。

标签: powershell

解决方案


Here you go:

$group = Get-AdGroup "DLName" -Properties info
$notes = $group.info
$notes += " Comment"
Set-AdGroup $group -Replace @{info = $notes}

Bear in mind that Notes (LDAP attribute name info) is a single-valued attribute, so don't forget to add whitespaces or line breaks when appending values.


推荐阅读