我需要将计算机添加到事件日志读取器组。我尝试过下面的脚本。
$hostName = "Hostname"
$computername = $env:computername
$EventLogGroup = [adsi]"WinNT://$computername/Event Log Readers,group"
$temp = "WinNT://$hostName"
$EventLogGroup.Add($temp)
相同的脚本可用于将用户添加到组中以及添加未添加的计算机。
我认为我们需要将对象类型更改为计算机。位置将位于同一域中。
任何修改或替代脚本都会有帮助
“无法将成员添加到本地组或从本地组中删除成员,因为该成员不存在”这是我在执行脚本时遇到的错误
最佳答案
尝试在计算机名称后面添加域名和美元符号:
$temp = "WinNT://DomainName/$hostName$,computer"
关于powershell - 使用 Powershell 命令将计算机添加到事件日志读取器组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12154389/