Jump to content
Joe.McCall

Custom Remote Command Names

Recommended Posts

I have a working custom remote command that always shows as "Unknown Command" in the Command tab. I was assuming that the Name public string for the class would be what returned in the results, but it appears that is not the case or I am doing something incorrectly. The plugin is based off the "Custom Remote Agent Commands" example.

 

It's working otherwise, but it bugs me that it's not displaying the command name correctly. Any ideas?

Share this post


Link to post
Share on other sites

To elaborate further, I have a remote agent command (ISvcCommand) defined in a remote agent plugin like this:

public class RemoteCommands : ISvcCommand
    {
        private IServiceHost4 serviceHost;

        public int CommandNumber
        {
            get
            {
                return 50100;
            }
        }

        public void Decommision()
        {
        }

        public string ExecuteCommand(string parameters, ref int errorLevel)
        {
            string output="Placeholder.";
            
            return output;
        }

        public void Initialize(LabTech.Interfaces.IServiceHost2 host)
        {
            serviceHost = (IServiceHost4)host;
        }
        public object MessageFromTray(int consoleNumber, object parameters)
        {
            return null;
        }
        public string Name
        {
            get
            {
                return "Custom Remote Command";
            }
        }
}

And I have an IControlCommand defined in a separate control center plugin like this:

public class ControlCommand : IControlCommand
    {

        private IControlCenter _host;

        public int CommandNumber
        {
            get
            {
                return 50100;
            }
        }

        public string Name
        {
            get
            {
                return "Custom Remote Command";
            }
        }

        public void Decommision()
        {
            this._host = (IControlCenter)null;
        }

        public void Initialize(IControlCenter host)
        {
            this._host = host;
        }
       
    }

But I only ever get this in the Commands window:

image.png.e8ad678ac9aebde0cb03f21fa6747e2e.png

So I am trying to figure out if I am missing some kind of definition or declaration somewhere in the code that will translate the command name through correctly to the Control Center when the command is run.

Share this post


Link to post
Share on other sites
2 hours ago, DarrenWhite99 said:

I don't know if you are missing a step, but check out the "pluginremotecommands" table....

The command is listed there, with the correct ID and whatnot. That seems to be generated automatically when the plugin is installed or the dbagent restarted. However, looking at that table pointed me in the right direction as the commands listed there did not match the commands showing in the Control Center. The Control Center description has to be manually entered into the remotecommands table.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×