在非域计算机上设置AD计算机

问题描述 投票:0回答:1

我想使用PowerShell在没有ActiveDirectory模块的干净计算机中添加AD中的扩展属性,所以我需要.Net等效于Set-ADComputer

例:

Set-ADComputer -Identity My-Computer -Replace @{
    extensionAttribute1 = "MyAttribute"
}
.net powershell active-directory
1个回答
0
投票
$pc = "computername$"
$obj = ([adsisearcher]"samaccountname=$pc").FindOne().GetDirectoryEntry()
if($obj) {
    $obj.Put("extensionAttribute1", "myattribute")
    $obj.SetInfo()
}

另一个社区帮助

© www.soinside.com 2019 - 2024. All rights reserved.