Blue Prism Product

Expand all | Collapse all

C# code to change Windows Pass

  • 1.  C# code to change Windows Pass

    Posted 02-14-2020 09:23
    Guys,

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

    Thanks,
    Ionut

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

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


  • 2.  RE: C# code to change Windows Pass

    Posted 02-14-2020 12:00
    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
    ------------------------------



  • 3.  RE: C# code to change Windows Pass

    Posted 02-14-2020 13:08
    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
    ------------------------------



  • 4.  RE: C# code to change Windows Pass

    Posted 02-14-2020 13:53
    Edited by Dave Morris 9 days ago
    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
    ------------------------------



  • 5.  RE: C# code to change Windows Pass

    Posted 02-14-2020 14:09
    Edited by Ionut Cohen 9 days ago
    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
    ------------------------------