Thursday 29 November 2012

3 methods to add domain user or group to local admin group

local host name: lsong-test
domain:  lsong.ca
user: lsong\testuser
group: lsong\group name with more than 20 characters

1. net local group administrators /add lsong\testuser

it's easy way, but user or group name have to be limited to 20 characters.

2. VBscript
Set objAdmins = GetObject("WinNT://lsong-test/Administrators")
Set objGroup = GetObject("WinNT://lsong.ca/group name with more than 20 characters")
objAdmins.add(objGroup.ADsPath)

This method has no 20 characters limitation for the user or group's name, but need to log on with domain account. If using local account to log in, it won't find domain object.

3. Cusrmgr.exe
cusrmgr -u "lsong\group name with more than 20 characters" -alg Administrators

cusrmgr command can work with user or group which name exceed 20 characters. But this command can only be found in Windows2000 Resource Kit. You have to copy it to local computer.

No comments:

Post a Comment