我想使用PowerShell从没有ActiveDirectory模块的干净计算机中添加AD中的扩展属性,因此我需要一个等效于Set-ADComputer
的.Net。
示例:
Set-ADComputer -Identity My-Computer -Replace @{
extensionAttribute1 = "MyAttribute"
}
答案 0 :(得分:0)
$pc = "computername$"
$obj = ([adsisearcher]"samaccountname=$pc").FindOne().GetDirectoryEntry()
if($obj) {
$obj.Put("extensionAttribute1", "myattribute")
$obj.SetInfo()
}
另一个社区的帮助