Quote:

I still can't have it add when I select a group from a list




What do you mean by that exactly?

Here is another example, not in a UDF (Function) format, but should give you a little more of an idea of how it works. But I assume that Bryce's UDF does work too, but maybe we need to see how you're calling it and using it.

Can you post your code here so we can see how you're using it?

Code:
Dim $Computer,$AccountToAdd,$GroupToAdd,$GroupToAddTo,$Domain,$Group,$User
$Computer = 'workstation15'
$AccountToAdd = 'FMLAST'
$GroupToAdd = '$MyCorp-Admins'
$GroupToAddTo = 'Administrators'
$Domain = 'MyCorp'
 
; Modify the $GroupToAdd or $AccountToAdd "groups need ,group, accounts need ,account"
$Group = GetObject('WinNT://' + $Computer + '/' + $GroupToAddTo + ',group')
$User = GetObject('WinNT://' + $Domain + '/' + $GroupToAdd + ',group')
; $User = GetObject('WinNT://' + $Domain + '/' + $AccountToAdd + ',user')
$Group.Add($User.ADsPath)
fnCOMErr(@ERROR)
? 'Return value: ' +@ERROR +' '+@SERROR
 
Function fnCOMErr($lErr)
If $lErr<0 $lErr=VAL("&"+Right(DecToHex($lErr),4)) EndIf
Exit $lErr
Endfunction