Using kix and adsi to try to add a AD computer to an AD group in the same domain. Searched the forums and cannot seem to find anything....tried running the following code but can't seem to get it to work.

Code:

$pcname="MyComputer"


;Check PC exists in AD
$PC = GetObject("WinNT://MyDomain/$pcname")

;If Exist add to group
If $error=0
$oGroup = ("WinNT://MyDomain/MyGroup,group")
$oGroup.Add ("WinNT://MyDomain/$pcname")
$oGroup.Setinfo
EndIf

Anyone have any idea what is wrong with the above.

Thanks,