Re: Add A User, Add User To Group by trading_jacks
trading_jacks
Fri Oct 13 15:26:01 CDT 2006
strComputer = "atl-ws-01"
Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators")
Set objUser = GetObject("WinNT://" & strComputer & "/kenmyer")
objGroup.Add(objUser.ADsPath)
Just change "/Administrators" to "/Power Users" or whatever you have
setup.
if you need to add a domain user to the local group do this:
Set oWshNet = CreateObject("WScript.Network")
strComputer = oWshNet.ComputerName
Set objGroup = GetObject("WinNT://" & strComputer & "/Power Users")
Set objUser = GetObject("WinNT://Domain/AD Object")
On Error Resume Next
objGroup.Add(objUser.ADsPath)
On Error Goto 0