Backing up a controller via an Addin

scottMHAscottMHA Luton, United Kingdom
I have an addin with a button to be able to backup all controller found on a network scan.

This works perfectly for virtual controllers but i get a generic error when attempting to backup online (real world) controllers. See below for how i currently do it. Any suggestions on another approach?

            NetworkScanner runningcontrollers = new NetworkScanner();
            runningcontrollers.Scan();
            ControllerInfo[] aCollection = runningcontrollers.GetControllers();
            int NumOfActiveControllers = aCollection.Count();

            if (NumOfActiveControllers != 0)
            {
                for (int i = 0; i < aCollection.Count(); i++)
                {
                    systemId = aCollection[i].SystemId;
                    Controller con = new Controller(systemId);
                    con.BackupCompleted += Con_BackupCompleted;

                    con.Logon(UserInfo.DefaultUser);

                    con.Backup("C:\temp\backups");

Comments

  • AdamSGAdamSG Sweden admin
    Hello!

    When you backup using con.Backup the path you specify as an argument is the path on the remote controller and not the path on your local machine. It could for example be
    /hd0a/XXX-XXXXX/HOME/MyBackup.

    If you want to save the backup to your local machine you could first copy it over from the remote controller to your local machine and then remove the backup from the controller.

    Adam Gustavsson
    PC Software Support Engineer
  • scottMHAscottMHA Luton, United Kingdom
    edited October 2018
  • scottMHAscottMHA Luton, United Kingdom
    AdamSG said:
    Hello!

    When you backup using con.Backup the path you specify as an argument is the path on the remote controller and not the path on your local machine. It could for example be
    /hd0a/XXX-XXXXX/HOME/MyBackup.

    If you want to save the backup to your local machine you could first copy it over from the remote controller to your local machine and then remove the backup from the controller.
    Hi Adam,

    You mention above that i need to copy the backup from the remote controller but when attempting to do so using both the FileSystem.GetDirectory and FileSystem.CopyDirectory i get the exception "Object reference not set to an instance of an object".

    Both the remote file and destination exists, any ideas on this?
  • Johannes WeimanJohannes Weiman ABB Sweden admin
    What version of PCSDK are you using?
  • scottMHAscottMHA Luton, United Kingdom
    What version of PCSDK are you using?
    6.07
Sign In or Register to comment.