473,386 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Change windows user account password

Hi All,

Can any one tell me how to change windows user account password
by programmatically using C#? I don't have administrator privileges and I
want to change my account password by programmatically.

I will be thankful if you can provide a sample program.

Thanks in Advance,

Srikanth

Nov 16 '05 #1
4 25081
Hi Srikanth!

It's easy, just use the System.DirectoryServices namespace to invoke
IADsUser::SetPassword:

http://msdn.microsoft.com/library/de..._passwords.asp

ok,
aq

"Srikanth" <ta*****@inooga.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi All,

Can any one tell me how to change windows user account password by programmatically using C#? I don't have administrator privileges and I
want to change my account password by programmatically.

I will be thankful if you can provide a sample program.

Thanks in Advance,

Srikanth

Nov 16 '05 #2
Think you also have win32 NetUserSetInfo pinvoke.

--
William Stacey, MVP
http://mvp.support.microsoft.com

"Srikanth" <ta*****@inooga.com> wrote in message
news:#G**************@TK2MSFTNGP09.phx.gbl...
Hi All,

Can any one tell me how to change windows user account password by programmatically using C#? I don't have administrator privileges and I
want to change my account password by programmatically.

I will be thankful if you can provide a sample program.

Thanks in Advance,

Srikanth


Nov 16 '05 #3
You can't call SetPassword if you are not an administrator! And that's what
OP said isn't it?

Willy.

"Ahmed Qurashi" <ah**********@gmail.com> wrote in message
news:un****************@TK2MSFTNGP11.phx.gbl...
Hi Srikanth!

It's easy, just use the System.DirectoryServices namespace to invoke
IADsUser::SetPassword:

http://msdn.microsoft.com/library/de..._passwords.asp

ok,
aq

"Srikanth" <ta*****@inooga.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi All,

Can any one tell me how to change windows user account

password
by programmatically using C#? I don't have administrator privileges and I
want to change my account password by programmatically.

I will be thankful if you can provide a sample program.

Thanks in Advance,

Srikanth


Nov 16 '05 #4

"Srikanth" <ta*****@inooga.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi All,

Can any one tell me how to change windows user account password
by programmatically using C#? I don't have administrator privileges and I
want to change my account password by programmatically.

I will be thankful if you can provide a sample program.

Thanks in Advance,

Srikanth


Use the System.DirectoryServices to change the password of a local user
account.

Something like this will do.

using System;
using System.DirectoryServices;
// correct the userPath!!!
string userPath = "WinNT://yourMachineName/someuser";
using (DirectoryEntry userEntry = new DirectoryEntry(userPath))
{
object[] password = new object[] {"newPwd", "oldPwd"};
object ret = userEntry.Invoke("ChangePassword", password );
userEntry.CommitChanges();
}

Willy.
Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Srikanth | last post by:
Hi All, Can any one tell me how to change windows user account password by programmatically using C#? I don't have administrator privileges and I want to change my account password by...
3
by: Ching Liang | last post by:
In my web application, I need to authenticate users to the AD and allow users to change the password. From my readings, I find out that I have to use DirectoryEntry class to authenticate the users...
2
by: http://www.visual-basic-data-mining.net/forum | last post by:
Dear all... Does anyone know how to get a list of windows user accounts? With Principal.WindowsIdentity.GetCurrent.Name, we can get the name of the current user. How can I get the other user's...
1
by: Henry | last post by:
Hi, how can I create a new windows user account in VB.Net code and add it to the admin or power user group? Thanks in advance. -- Best regards Henry
6
by: lanem | last post by:
Is it possible for me to get the actual windows user account that a user is logged in on their computer as? If they are logged on and authenticated on my network, can I get that username from my...
1
by: yossisht | last post by:
Hello, I am trying to change a service from running under System Account to Domain User account. I a running the following command: wmic service <ServiceName> call change StartName =...
2
by: questionit | last post by:
Hi I am begginner in Windows account management. I have administrative account and several softwares are installed within this account. Another account (guest123) is created but no software...
0
by: teejayem | last post by:
Hi. I have searched the groups and have been unable to find an answer to my question. I am trying to reset the password of a user account in active directory. I have been trying to do this...
0
by: BobLewiston | last post by:
How do you create a Windows user account with system-level priveleges (above administrator-level), and why would you want to? I'm running Windows XP Pro.
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.