Click here to Skip to main content
13,045,657 members (66,096 online)
Click here to Skip to main content
Add your own
alternative version


57 bookmarked
Posted 30 Apr 2007

Reset Windows Administrator Account Password in C#

, 14 Nov 2010
Rate this:
Please Sign up or sign in to vote.
How to Reset Windows Administrator Account Password in C# (Silently)


By using this technique you can reset the Windows Administration Account password to what ever you want. In addition, with some changes, you can also reset other Windows Account passwords. However, the most importent point of this technique is that the method runs silently (hidden) and does not show the CMD Window. I hope this is useful to you!

Using the code

Just copy and paste the following code into your Project.

using System.Diagnostics; 
private static void ResetAdminPass(string NewPass)
    //Create New Process
    Process QProc = new Process();

    // Do Something To hide Command(cmd) Window
    QProc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
    QProc.StartInfo.CreateNoWindow = true;

    // Call Net.exe
    QProc.StartInfo.WorkingDirectory = "C:\\windows\\SYSTEM32";
    QProc.StartInfo.FileName = "net.exe";
    QProc.StartInfo.UseShellExecute = false;
    QProc.StartInfo.RedirectStandardError = true;
    QProc.StartInfo.RedirectStandardInput = true;
    QProc.StartInfo.RedirectStandardOutput = true;

    // Prepare Command for Exec
    QProc.StartInfo.Arguments = @" user administrator " + NewPass;

    // MyProc.WaitForExit();

For example you can create a Windows Forms Application (C#) and in Form_Load() do this:

private void Form1_Load(object sender, EventArgs e)

Note that you can simply change "administrator" to what ever you like and reset that account instead.

Points of Interest

I use this code snippet in my project to help my clients so that each time they change their password in my program, their Windows Administrator Account password changes, too!

I hope this is useful to you!


Version 1.0


This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


About the Author

Ghasem Nobari
Team Leader
Iran (Islamic Republic of) Iran (Islamic Republic of)
Ghasem - Nobari

You may also be interested in...

Comments and Discussions

RantNice code - for malware Pin
jcurren19-May-11 14:11
memberjcurren19-May-11 14:11 
Generalits not working...File is not uploading. Pin
ShoaibRiaz15-Mar-11 1:03
memberShoaibRiaz15-Mar-11 1:03 
GeneralMy vote of 1 Pin
CP@work16-Nov-10 6:34
memberCP@work16-Nov-10 6:34 
GeneralMy vote of 1 Pin
jl.deka15-Nov-10 1:28
memberjl.deka15-Nov-10 1:28 
GeneralMy vote of 1 Pin
OriginalGriff14-Nov-10 23:41
memberOriginalGriff14-Nov-10 23:41 
GeneralVery poor code example Pin
Socrates#14-Nov-10 19:22
memberSocrates#14-Nov-10 19:22 
GeneralRe: Very poor code example Pin
xComaWhitex14-Nov-10 23:08
memberxComaWhitex14-Nov-10 23:08 
GeneralRe: Very poor code example Pin
CP@work16-Nov-10 6:32
memberCP@work16-Nov-10 6:32 
GeneralMy vote of 1 Pin
Socrates#14-Nov-10 19:19
memberSocrates#14-Nov-10 19:19 
QuestionIs local administrator password is blank ?? Pin
priyanka_jns15-Jun-09 2:02
memberpriyanka_jns15-Jun-09 2:02 
Generalonly first time Pin
amedrano21-Apr-09 4:02
memberamedrano21-Apr-09 4:02 
GeneralGreat Code! Pin
gobriye0930-Mar-09 20:37
membergobriye0930-Mar-09 20:37 
GeneralRe: Great Code! Pin
Argyle4Ever14-Nov-10 21:53
memberArgyle4Ever14-Nov-10 21:53 
GeneralMy vote of 1 Pin
George Zorba16-Feb-09 3:34
memberGeorge Zorba16-Feb-09 3:34 
GeneralRe: My vote of 1 Pin
xComaWhitex14-Nov-10 23:07
memberxComaWhitex14-Nov-10 23:07 
Generalretrieve users accounts Pin
Member 407499321-Mar-08 23:55
memberMember 407499321-Mar-08 23:55 
GeneralAnother question! Pin
gulbenalkan13-Jun-07 3:34
membergulbenalkan13-Jun-07 3:34 
GeneralRe: Another question! Pin
QHN_PROF13-Jun-07 4:52
memberQHN_PROF13-Jun-07 4:52 
QuestionIs it possible? Pin
gulbenalkan13-Jun-07 1:44
membergulbenalkan13-Jun-07 1:44 
AnswerRe: Is it possible? Pin
gulbenalkan13-Jun-07 3:03
membergulbenalkan13-Jun-07 3:03 
Generalyou must logged in as administrator to successfully run the code.. Pin
Damoooon30-Apr-07 20:07
memberDamoooon30-Apr-07 20:07 
GeneralRe: you must logged in as administrator to successfully run the code.. Pin
QHN_PROF30-Apr-07 21:55
memberQHN_PROF30-Apr-07 21:55 
QuestionHow Can we Share folder with C# Pin
kolmbos30-Apr-07 13:53
memberkolmbos30-Apr-07 13:53 
AnswerRe: How Can we Share folder with C# Pin
QHN_PROF2-May-07 9:56
memberQHN_PROF2-May-07 9:56 
GeneralThat's Great Pin
robert50430-Apr-07 13:20
memberrobert50430-Apr-07 13:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170713.1 | Last Updated 14 Nov 2010
Article Copyright 2007 by Ghasem Nobari
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid