[RESOLVED] [2005] - Add user to group
hello
i have this code, i'm coding in vista, but the target it's the xp...
can anyone tell me if this code does the job, create a new user and add the user to the administrators group?
vb.net Code:
Dim directoria As New DirectoryServices.DirectoryEntry("WinNT://" + Environment.MachineName + ",computer")
Dim novo_user As DirectoryServices.DirectoryEntry = directoria.Children.Add("User1000", "user")
novo_user.CommitChanges()
Dim grupos As DirectoryServices.DirectoryEntry
grupos = directoria.Children.Find("Administrator", "group")
If grupos.Name <> "" Then
MsgBox("Add....")
novo_user.Invoke("Add", New Object() {novo_user.Name.ToString})
MsgBox("Added.....")
Else
MsgBox("Nothing")
End If
In the vista i get an error that the group doesn't exists...
Re: [2005] - Add user to group
If that is the case, then in Vista, it probably doesn't exist.
Re: [2005] - Add user to group
the group name should be "Administrators" (plural)
Re: [2005] - Add user to group