
|
email this FAQ to a colleague
Q:
How do I add a domain user to a local group using ADSI?
A:
Here is some code that uses ADSI to add a domain user to a local group:
strPDC="MACHINENAME"
strLocalMachine="MACHINENAME"
strUser="jdoe"
strGroup="Unidentified"
Set oDomain = GetObject("WinNT://" & strLocalMachine)
Set oGroup = oDomain.GetObject("Group", strGroup)
oGroup.Add ("WinNT://" & strPDC & "/" & strUser)
Set oDomain=Nothing
Set oGroup=Nothing
- Wayne Berry
|