Adding new user to admin group

C

Ching-Lung

Hi,

Is there any way to add new user to local admin group in
C# ASP.NET?

Thanks,
-CL
 
C

Coucou à toutes et à tous

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.

Chris

--------------------
 

Ask a Question

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.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top