How to reset Windows Seven password
I am looking forward to reset password of Windows Seven by my app.
Using command
Code:
net user user_name *
But I don't know how to run this command
Code:
process.start("net user" & user_name & "*")
gives error.
So how to do that or is there any other direct command which can change/reset windows password.
Re: How to reset Windows Seven password
How about using the tools provided by Windows 7?
Re: How to reset Windows Seven password
Quote:
process.start("net user" & user_name & "*")
Try this with appropriate spaces...
Code:
process.start("net user " & user_name & " *")
Note: I am assuming that you are the administrator....
Re: How to reset Windows Seven password
Nope it doesn't work Win32Exception program doesn't run
any other ideas
Quote:
System.ComponentModel.Win32Exception was unhandled
ErrorCode=-2147467259
Message="The system cannot find the file specified"
NativeErrorCode=2
Source="System"
StackTrace:
at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start() at System.Diagnostics.Process.Start(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start(String fileName) at _1Click_Reset.Form1.Button1_Click(Object sender, EventArgs e) in J:\Users\Mad Geek\Documents\Visual Studio 2008\Projects\1Click Reset\1Click Reset\Form1.vb:line 14 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoCompo nentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(ApplicationContext context) at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine) at _1Click_Reset.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()
InnerException:
Re: How to reset Windows Seven password
The system cannot find the file specified
Re: How to reset Windows Seven password
The first command you're sending, isn't a command. It's supposed to be the file name. So when you send, "net user", your application is looking for something to launch either in the SYSTEM PATH or the path of your application, called "net user."
Chances are, you want to send this command with the command window, correct?
If so, you'll need to do something like this:
vb Code:
Dim p As New Process
p.StartInfo.Arguments = "<arguments you would type into a command window>"
p.StartInfo.FileName = "cmd"
p.Start()
p.Dispose()
Normally, you'd also need to specify the FilePath, but since the command window is located in the SYSTEM PATH, that isn't needed.
Also, as previously stated, you need to be have administrator privileges in order to reset a windows password. Also, process needs to be elevated in order for net user to work.
In order to elevate the process, you'll need one more line of code. It will be a StartInfo object called Verb. You'll need to pass a string to it called runas. I'll leave it up to you to add it in there.
Re: How to reset Windows Seven password
@weirddemon
But this one also doesn't help all it does is it opens Command Prompt and thats it, no argument were passed using this method.
Re: How to reset Windows Seven password
Then you're doing something wrong.
Post the exact code you're using.
Re: How to reset Windows Seven password
vb Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myReg As String = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "RegisteredOwner", Nothing)
'MsgBox(myReg)
Dim p As New Process
p.StartInfo.Arguments = "net user " & myReg & " *"
p.StartInfo.FileName = "cmd"
p.Start()
p.Dispose()
End Sub
Re: How to reset Windows Seven password
Well, first, if you really want to use the registry to get the current user, you can. But VB .NET provides a method for that: Environment.Username.
Second, as I mentioned, you need to elevate the User permissions. But, I'm only guessing about that being the issue.
So, I need to know what's showing up in the command box. Nothing at all? No text whatsoever?
Re: How to reset Windows Seven password
Actually, I looked into it, and it's not working... which is odd. There might be an an alternate method used for the command window. I'm looking into it.
Re: How to reset Windows Seven password
Here is the text
Quote:
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
J:\Users\Mad Geek\Documents\Visual Studio 2008\Projects\1Click Reset\1Click Rese
t\bin\Debug>
Yeah I am too looking for that thanks for helping me
Re: How to reset Windows Seven password
curious why you would reset the windows 7 password? i can think of 2 reasons:- your password is changing (a virus perhaps?) or you have a validation issue with your license.
Re: How to reset Windows Seven password
^ neither of the above two I am creating an application which give user the flexibility to reset password in 1 click.
Re: How to reset Windows Seven password
Re: How to reset Windows Seven password
I'm thinking you'll need to use SendInput. In which case, you'll need to use RedirectSnedInput from the StartInfo object.
I don't have time to look at it, but if I do tonight, I will.