Sign in to follow this  
Followers 0
clariceo0

Free library for resetting windows password?

6 posts in this topic

Recently, I am interested to build a windows app to reset Windows login password as a side off project. I am still a newbie in programming so i am not able to build the app from scratch. Is there any open source  project i could learn from on this?

Share this post


Link to post
Share on other sites



Hi, @clariceo0, welcome to the forum. A couple of questions to help us help you:

  • Are you looking to change the password from within the machine itself or remotely?
  • Are you doing this on domain computers, or just local users on local PCs?
  • Are you wanting to allow users to do this themselves (something sitting on the desktop they can click on), and if so do they have administrative rights to do so?

The more info you can provide us with, the better we can assist you, so we're not throwing out suggestions that may not work for your situation.


When you're dead, you don't know you're dead - it's only difficult for those that know you. It's the same way when you're stupid...

My Scripts: SCCM UDFInclude Source with Compiled Script, Windows Firewall UDF

Share this post


Link to post
Share on other sites
12 hours ago, JLogan3o13 said:

Hi, @clariceo0, welcome to the forum. A couple of questions to help us help you:

  • Are you looking to change the password from within the machine itself or remotely?
  • Are you doing this on domain computers, or just local users on local PCs?
  • Are you wanting to allow users to do this themselves (something sitting on the desktop they can click on), and if so do they have administrative rights to do so?

The more info you can provide us with, the better we can assist you, so we're not throwing out suggestions that may not work for your situation.

 thanks for the great suggestion. I just want to change or reset the password of local account. I will write a GUI client for this to help normal users without much technical knowledge.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

@clariceo0 Usually we follow more of a "teach a man to fish" motto rather than just handing folks scripts, but I had this one lying about. It should give you an idea how to proceed anyway; you will probably need to modify to your needs. Also you'll want to test heavily; it is an older script which I have not tested on Windows 10. Let me know if you have any questions:

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>

Local $sUserName, $sPassword

$hGUI = GUICreate("Reset Local Password", 300, 300)
    GUISetState(@SW_SHOW)
    GUISetFont(11, 400, Default, "Arial")

    $lblUserName = GUICtrlCreateLabel("Username", 115, 10, 65, 30)
    $lblPassword = GUICtrlCreateLabel("Choose New Password", 75, 90, 150, 30)
    $lblVerify = GUICtrlCreateLabel("Verify New Password", 75, 170, 150, 30)

    $inpUserName = GUICtrlCreateInput(@UserName, 10, 40, 280, 30, $ES_CENTER)
    $inpPassword = GUICtrlCreateInput("", 10, 120, 280, 30, $ES_PASSWORD)
    $inpVerify = GUICtrlCreateInput("", 10, 200, 280, 30, $ES_PASSWORD)

    $btnGo = GUICtrlCreateButton("Change Password", 10, 250, 125, 35)
    $btnClose = GUICtrlCreateButton("Exit", 165, 250, 125, 35)

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE, $btnClose
                ExitLoop
            Case $btnGo
                If GUICtrlRead($inpPassword) == GUICtrlRead($inpVerify) Then
                    $sUserName = GUICtrlRead($inpUserName)
                    $sPassword = GUICtrlRead($inpPassword)
                    _changePW($sUserName, $sPassword)
                Else
                    MsgBox(0, "Reset Local Password", "Passwords do not match!")
                EndIf
        EndSwitch
    WEnd

Func _changePW($UserName, $Password)
    $oUser = ObjGet("WinNT://" & @ComputerName & "/" & $UserName)
        If IsObj($oUser) Then
            $oUser.SetPassword($Password)
            $oUser.SetInfo
        EndIf
EndFunc

 

   Edit: Also, although you posted in a C++ forum you didn't specify that you need this done in C++/C. Are you just looking to get the job done, or do you have a language requirement that it needs to be coded in?

Edited by JLogan3o13
1 person likes this

When you're dead, you don't know you're dead - it's only difficult for those that know you. It's the same way when you're stupid...

My Scripts: SCCM UDFInclude Source with Compiled Script, Windows Firewall UDF

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

@JLogan3o13 thanks for the help. I will figure out the code myself and port it into C++.  so i can build a GUI with QT.  I find a good example of the program called UUkeys. Here is the tutorial on how to reset windows password. that is exactly what i am looking for.

Edited by clariceo0

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

On ‎12‎/‎05‎/‎2016 at 7:40 AM, Aquarium said:
On ‎11‎/‎05‎/‎2016 at 3:29 AM, clariceo0 said:

Recently, I am interested to build a windows app to reset Windows login password as a side off project. I am still a newbie in programming so i am not able to build the app from scratch. Is there any open source  project i could learn from on this?

You can use the api fuction NetUserChangePassword.

#ifndef UNICODE
#define UNICODE
#endif
#pragma comment(lib, "netapi32.lib")

#include <stdio.h>
#include <windows.h> 
#include <lm.h>

int wmain(int argc, wchar_t *argv[])
{
   DWORD dwError = 0;
   NET_API_STATUS nStatus;
   //
   // All parameters are required.
   //
   if (argc != 5)
   {
      fwprintf(stderr, L"Usage: %s \\\\ServerName UserName OldPassword NewPassword\n", argv[0]);
      exit(1);
   }
   //
   // Call the NetUserChangePassword function.
   //
   nStatus = NetUserChangePassword(argv[1], argv[2], argv[3], argv[4]);
   //
   // If the call succeeds, inform the user.
   //
   if (nStatus == NERR_Success)
      fwprintf(stderr, L"User password has been changed successfully\n");
   //
   // Otherwise, print the system error.
   //
   else
      fprintf(stderr, "A system error has occurred: %d\n", nStatus);

   return 0;
}

 

 

Edited by Melba23
Removed ad link in quote

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • wtarkan
      By wtarkan
      If I create a service to run a program , Application window cannot Appear - How can I make the App window visible
    • ur
      By ur
      Whenever we try to access a network share it will prompt for credentials based on the shared folder settings.
      Like the below prompt


      Once you save them, they are saved in Windows Credentials of Credentials Manager in Control panel (run --> control keymgr.dll).

       
      But not able to found exact file or registry for this setting.
       
      So, can anyone suggest how to do this process of adding network credentials using AutoIT.
       
    • onlineth
      By onlineth
      Basically, I want to unlock a user account by executing a script (while a user see's their locked screen, if this script is executed in the background, it unlocks their account without having to type in any password). In a perfect world, I would have a service running that can automatically log specific users in whether their account is locked or they just turned their computer on and no users have been logged in yet.
      I don't want to have anything special enabled on the computer (like the remote desktop workaround). I can provide the actual password to the account and I would like this to be compatible on Windows 7.
      Has anyone come across any script that can do this? If there isn't a way to unlock the computer from startup, is there at least a way to unlock the account that's currently already logged into but just has the lock screen up?
    • Graeme
      By Graeme
      I have code to enter password using the setting $ES_PASSWORD. It seems that with this setting you can't enter more than the letters that fill box. Can anyone tell me how to enter more characters?
      GUICreate("Password Test",500,200) $Input = GUICtrlCreateInput("Password",10,20,40,50,$ES_PASSWORD) GUISetState(@SW_SHOW,"Password Test") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUISetState(@SW_HIDE,"Password Test") ExitLoop EndSwitch WEnd If GUICtrlRead($Input) <> "" Then MsgBox(0,GUICtrlRead($Input),"Done") With this code you can only enter 4 characters of password.
    • powerbass4
      By powerbass4
      Hi, I need the help of some "C++ Pros" of you....

      The "WINAPI GetLogicalProcessorInformation" function does not exists in the AutoIt Includes, so I decided to build it on my own ....no success so far.
      I adapted easy functions, but this one seems to be odd and unfamiliar.

      I hope somebody can help me.... and after that this function should be added to the Includes (WinAPISys.au3).
       
      BOOL WINAPI GetLogicalProcessorInformation( _Out_ PSYSTEM_LOGICAL_PROCESSOR_INFORMATION Buffer, _Inout_ PDWORD ReturnLength ); https://msdn.microsoft.com/en-us/library/windows/desktop/ms683194(v=vs.85).aspx
       
      typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION { ULONG_PTR ProcessorMask; LOGICAL_PROCESSOR_RELATIONSHIP Relationship; union { struct { BYTE Flags; } ProcessorCore; struct { DWORD NodeNumber; } NumaNode; CACHE_DESCRIPTOR Cache; ULONGLONG Reserved[2]; }; } SYSTEM_LOGICAL_PROCESSOR_INFORMATION, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION; https://msdn.microsoft.com/en-us/library/windows/desktop/ms686694(v=vs.85).aspx