Click here to Skip to main content
Licence GPL3
First Posted 30 Apr 2007
Views 53,008
Bookmarked 51 times

Reset Windows Administrator Account Password in C#

By | 14 Nov 2010 | Article
How to Reset Windows Administrator Account Password in C# (Silently)

Introduction

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;
    QProc.Start();

    // MyProc.WaitForExit();
    QProc.Close();
}
//

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

 
private void Form1_Load(object sender, EventArgs e)
{
    ResetAdminPass("12345ABC");
}

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!

History

Version 1.0

License

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

About the Author

Ghasem Heyrani Nobari

Software Developer (Senior)

Iran (Islamic Republic Of) Iran (Islamic Republic Of)

Member

Ghasem - Heyrani-Nobari
http://SQNco.com
http://Ajaxdic.com
Qasem*AT*SQNco.com

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
RantNice code - for malware Pinmemberjcurren14:11 19 May '11  
Generalits not working...File is not uploading. PinmemberShoaibRiaz1:03 15 Mar '11  
GeneralMy vote of 1 PinmemberCP@work6:34 16 Nov '10  
GeneralMy vote of 1 Pinmemberjl.deka1:28 15 Nov '10  
GeneralMy vote of 1 PinmemberOriginalGriff23:41 14 Nov '10  
GeneralVery poor code example PinmemberSocrates#19:22 14 Nov '10  
GeneralRe: Very poor code example PinmemberxComaWhitex23:08 14 Nov '10  
GeneralRe: Very poor code example PinmemberCP@work6:32 16 Nov '10  
GeneralMy vote of 1 PinmemberSocrates#19:19 14 Nov '10  
QuestionIs local administrator password is blank ?? Pinmemberpriyanka_jns2:02 15 Jun '09  
Generalonly first time Pinmemberamedrano4:02 21 Apr '09  
GeneralGreat Code! Pinmembergobriye0920:37 30 Mar '09  
GeneralRe: Great Code! PinmemberArgyle4Ever21:53 14 Nov '10  
GeneralMy vote of 1 PinmemberGeorge Zorba3:34 16 Feb '09  
GeneralRe: My vote of 1 PinmemberxComaWhitex23:07 14 Nov '10  
Generalretrieve users accounts PinmemberMember 407499323:55 21 Mar '08  
GeneralAnother question! Pinmembergulbenalkan3:34 13 Jun '07  
GeneralRe: Another question! PinmemberQHN_PROF4:52 13 Jun '07  
QuestionIs it possible? Pinmembergulbenalkan1:44 13 Jun '07  
AnswerRe: Is it possible? Pinmembergulbenalkan3:03 13 Jun '07  
Generalyou must logged in as administrator to successfully run the code.. PinmemberDamoooon20:07 30 Apr '07  
GeneralRe: you must logged in as administrator to successfully run the code.. PinmemberQHN_PROF21:55 30 Apr '07  
QuestionHow Can we Share folder with C# Pinmemberkolmbos13:53 30 Apr '07  
AnswerRe: How Can we Share folder with C# PinmemberQHN_PROF9:56 2 May '07  
GeneralThat's Great Pinmemberrobert50413:20 30 Apr '07  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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 | Mobile
Web04 | 2.5.120517.1 | Last Updated 14 Nov 2010
Article Copyright 2007 by Ghasem Heyrani Nobari
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid