Change user password through PC-SDK

Hello.

I would like to change user password though pc-sdk. I checked at reference, but I didn’t succeced … class userinfo has a password property, but I got a exception when I try to change its value. Besides the method DemandWriteAccess cannot be called. I’m using PC-SDK 5.15

Any clue?

Hi MrRogerf,

I think you should to do a Request Mastership from controller to modify the password.

  1. C#
    VB
    C++
    F#

    Copy to ClipboardPrint

    using (ABB.Robotics.Controllers.Mastership m =
        ABB.Robotics.Controllers.Mastership.Request(controller.Rapid))
    

Thanks, ArmanDb, but I haven’t success so far . I still got an Exception when I try to set user.password. I also tried controller.Configuration instead of controller.Rapid. Part of my code is bellow:


if (controllerInfo.Availability == Availability.Available)
{ Controller controller = ControllerFactory.CreateFrom(controllerInfo);

UserInfo user = new UserInfo(“MyFullAccessUser”,“MyPassword”);

controller.Logon(user);

if (controller.CurrentUser.Name == “MyFullAccessUser”)
{
using (ABB.Robotics.Controllers.Mastership m = ABB.Robotics.Controllers.Mastership.Request(controller.Rapid))
{
if (m.IsMaster)
{ System.Console.WriteLine(“I’m the master”);

controller.CurrentUser.Password =“teste”; //unhandled exception
}
else
System.Console.WriteLine(“Ops … failed mastership”);
}