【发布时间】:2012-12-13 05:51:06
【问题描述】:
我有两台机器,比如说公司域CorpotateDomain。
第一台机器:first.CorpotateDomain.com
二:second.CorpotateDomain.com
我想使用 powershell 将第一台机器的 PrimUser 添加到第二台机器的管理员组。
然后我想使用shutdown 实用程序或stop-computer cmdlet 从第一台机器(使用PrimUser 登录)关闭第二台机器。 (或者例如远程重启iis)
有没有可能,我应该使用什么命令将域用户添加到管理员?
附言 我试过了:
$user = "WinNT://first.CorpotateDomain.com/PrimUser"
$group = New-Object System.DirectoryServices.DirectoryEntry("WinNT://./Administrators")
$group.PSBase.Invoke("Add",$user)
【问题讨论】:
标签: powershell active-directory powershell-2.0 powershell-remoting