cancel
Showing results for 
Search instead for 
Did you mean: 

C# code to change Windows Pass

Anonymous
Not applicable
Guys,

Do you have a C# code to change Windows Pass. Must have  input as NewPass and OldPass.

Thanks,
Ionut

------------------------------
Cohen
RPA Developer

Romania
------------------------------
4 REPLIES 4

david.l.morris
Level 14
Is there a reason it needs to be C#? Blue Prism's Login Agent VBO already has VB.NET code that does the same thing.

------------------------------
Dave Morris
3Ci @ Southern Company
Atlanta, GA
------------------------------
Dave Morris 3Ci at Southern Company Atlanta, GA

Anonymous
Not applicable
there is one!  I migrate all VB code to C#. And I need this  to put all the basic  functions into one big object that has all in it. This way I can share one object instead of sharing 20...

Thanks for your answer!

------------------------------
Cohen
RPA Developer

Romania
------------------------------

I see. Makes sense. That would be quite a large object. Have you seen any performance issues with doing that? Although, I suppose now that I think about it, an object that contains images for Surface Automation would likely be much larger than an object that just has the various functions/code in it. So I guess there's nothing wrong with doing that except that you'd have a big list in the action drop down. Interesting.

I glanced at the VB.NET code for Change Password and it is fairly simple. It shouldn't be too hard to convert it to C#, but you'll want some classes or whatever might be in the Global Code to go with it as well.

------------------------------
Dave Morris
3Ci @ Southern Company
Atlanta, GA
------------------------------
Dave Morris 3Ci at Southern Company Atlanta, GA

Anonymous
Not applicable
yeah, this did the trick.

PrincipalContext pc = new PrincipalContext(ContextType.Domain);
UserPrincipal up = UserPrincipal.FindByIdentity(pc, username);
up.ChangePassword(password, txtNewChangedPassword.Text);
up
.Save();

https://stackoverflow.com/questions/31010793/change-password-windows-ad-c-sharp

Thanks  to Stack Overflow

------------------------------
Cohen
RPA Developer

Romania
------------------------------