Add a User to a Local Group

Adds a user (kenmyer) to the local Administrators group on a computer named atl-ws-01.

VBScript Code


strComputer = "atl-ws-01"
Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators,group")

Set objUser = GetObject("WinNT://" & strComputer & "/kenmyer,user")
objGroup.Add(objUser.ADsPath)