By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,815 Members | 1,066 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,815 IT Pros & Developers. It's quick & easy.

How to change the windows user password with VB.NET

P: 3
I want to change the windows user password in a Module...
Just change it, how can i do that?
Apr 14 '12 #1

✓ answered by cherry11

To change windows password has many methods, but i don't know how to change windows user password with VB.NET.

I suggeset you google search for Smartkey Product Key Recovery to change windows password.

Share this Question
Share on Google+
4 Replies

Expert Mod 100+
P: 465
You're going to need to use the NetUserChangePassword Win32 API call for this to work. Here's a simple demonstration on using that API:

Expand|Select|Wrap|Line Numbers
  1. Public Class Class1
  2.     <DllImport("netapi32.dll", CallingConvention:=CallingConvention.StdCall, CharSet:=CharSet.Unicode)> _
  3.     Public Shared Function NetUserChangePassword( _
  4.          <MarshalAs(UnmanagedType.LPWStr)> ByVal Domain As String, _
  5.          <MarshalAs(UnmanagedType.LPWStr)> ByVal User As String, _
  6.          <MarshalAs(UnmanagedType.LPWStr)> ByVal OldPass As String, _
  7.     <MarshalAs(UnmanagedType.LPWStr)> ByVal NewPass As String) As Integer
  8.     End Function
  10.     Public Sub ChangePassword(ByVal domain As String, 
  11.         ByVal username As String,
  12.         ByVal oldPassword As String,
  13.         ByVal newPasword As String)
  15.         Try
  16.             NetUserChangePassword(domain, username, oldPassword, newPasword)
  17.         Catch ex As Exception            
  18.             Throw
  19.         End Try
  22.     End Sub
  23. End Class
You're be using the System.Runtime.InteropServices

That should get you started down the right path
Apr 15 '12 #2

P: 3
Thank you!
But is there a way to do that, without knowing the old password?
Apr 16 '12 #3

Expert Mod 100+
P: 465
No there isn't. This is starting to sound like a malicious act the more that get's asked.
Apr 16 '12 #4

P: 3
No, no, not at all!
It's a little program I have made to level up the privacy of my computer.
I wanted to generate a random code as a password that would be sent to my email...
Apr 17 '12 #5

Post your reply

Sign in to post your reply or Sign up for a free account.