|
-
Sep 18th, 2007, 05:44 PM
#1
Thread Starter
Frenzied Member
[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...
Last edited by Hack; Sep 19th, 2007 at 06:07 AM.
Reason: Fixed Highlight Tags
-
Sep 19th, 2007, 06:06 AM
#2
Re: [2005] - Add user to group
If that is the case, then in Vista, it probably doesn't exist.
-
Sep 19th, 2007, 07:27 AM
#3
Re: [2005] - Add user to group
the group name should be "Administrators" (plural)
-
Sep 20th, 2007, 07:10 PM
#4
Thread Starter
Frenzied Member
Re: [2005] - Add user to group
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|