Home Analyst Portal
Options

SCCM Remotecontrol task

Magnus_Lundgren1Magnus_Lundgren1 Customer Adept IT Monkey ✭✭
Would it be possible to starta remote session to the affected users primary device from the portal. We have this in the console today and its quite popular. its something that the helpdesk is missing.

I was able to start notepar with this.

app.custom.formTasks.add('Incident', "Search Google1", function (formObj, viewModel) { 
var oShell = new ActiveXObject("Shell.Application");
var commandtoRun = "C:\\Windows\\system32\\notepad.exe"; 
oShell.ShellExecute(commandtoRun,"","","open","1");
});

But how would i get the affected users primary device into a parameter?

Comments

  • Options
    Michael_BaldryMichael_Baldry Customer Advanced IT Monkey ✭✭✭
    edited June 2016
    You could use the API, and call "/ConfigItems/GetAffectedUserConfigItemsList". That will bring back all of the computers that they're a primary user of, as well as any Business Service where they're the owner (may also include ones where they're a Contact). Not sure if there's a way to limit it to only bring back the primary computers.

    This doesn't open any external applications, but will at least show you how to access the display name for all of the CIs.

    app.custom.formTasks.add('Incident', "Open Remote Control", function (formObj, viewModel) {
        var url = "/ConfigItems/GetAffectedUserConfigItemsList";
        $.ajax({
            url: url,
            type: "GET",
            data: {
                affectedUserId: function () {
                    return !_.isUndefined(viewModel.RequestedWorkItem) && !_.isNull(viewModel.RequestedWorkItem.BaseId) ? viewModel.RequestedWorkItem.BaseId : "";
                }
            },
            success: function (data) {
                var count = data.length;
                if (count == 0) {
                    // No primary computers found, show them an error message
                }
                // If they only have one primary computer
                else if (count == 1) {
                    console.log(data[0].Text);
                    // Open your program here, and pass in the Text property
                }
                else {
                    // Handle multiple results here. Pop up a window asking them to choose which one, pick the first one, etc.
                    for (var i = 0; i < count; i++) {
                        console.log(data[i].Text);
                    }
                }
            }
        });
    });
Sign In or Register to comment.