Here is one method that you could use to accomplish this:
You can invoke a DOS batch script which will add the user to the group. The
DOS command would be as follows:
net localgroup administrators DOMAIN\username /add
Then, generate a text file containing the above commands/usernames and save
the file as adduser.bat.
Then, add the following code to whatever event you wanted to use to add the
user:
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents=false;
proc.StartInfo.FileName="c:\\foldername\\adduser.bat";
proc.Start();
If you also need to create the user, you can add that command to your batch
file using the proper syntax for the addusers utility.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.