Adding new user to admin group

Discussion in 'ASP .Net' started by Ching-Lung, Jan 7, 2004.

  1. Ching-Lung

    Ching-Lung Guest

    Hi,

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

    Thanks,
    -CL
     
    Ching-Lung, Jan 7, 2004
    #1
    1. Advertising

  2. 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

    --------------------
    >Content-Class: urn:content-classes:message
    >From: "Ching-Lung" <>
    >Sender: "Ching-Lung" <>
    >Subject: Adding new user to admin group
    >Date: Wed, 7 Jan 2004 12:21:13 -0800
    >Lines: 7
    >Message-ID: <026601c3d55b$cbb9af70$>
    >MIME-Version: 1.0
    >Content-Type: text/plain;
    > charset="iso-8859-1"
    >Content-Transfer-Encoding: 7bit
    >X-Newsreader: Microsoft CDO for Windows 2000
    >Thread-Index: AcPVW8u58oboNYH9Rj2maM6colIwCQ==
    >X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
    >Newsgroups: microsoft.public.dotnet.framework.aspnet
    >Path: cpmsftngxa07.phx.gbl
    >Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.aspnet:200399
    >NNTP-Posting-Host: tk2msftngxa12.phx.gbl 10.40.1.164
    >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
    >
    >Hi,
    >
    >Is there any way to add new user to local admin group in
    >C# ASP.NET?
    >
    >Thanks,
    >-CL
    >
     
    Coucou à toutes et à tous, Jan 9, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chad Dressler
    Replies:
    0
    Views:
    644
    Chad Dressler
    Dec 30, 2006
  2. Scott
    Replies:
    2
    Views:
    668
    Gregory A. Beamer
    Nov 13, 2008
  3. sarah Fernandes
    Replies:
    0
    Views:
    516
    sarah Fernandes
    Nov 1, 2010
  4. Mathew Uthup

    Cannot access aspx page if user is not in Admin group

    Mathew Uthup, Jun 20, 2005, in forum: ASP .Net Security
    Replies:
    1
    Views:
    223
    Mathew Uthup
    Jun 22, 2005
  5. Phlip
    Replies:
    1
    Views:
    292
    Eero Saynatkari
    Sep 15, 2006
Loading...

Share This Page