D2Services

Show system services

javascript · D2 (Deprecated)

Details

IDD2Services
Languagejavascript
From Version5.0.0
Tagsagent endpoint

README

Shows the systems services.

Script Data


Name Description
Script Type javascript
Tags agent, endpoint

Inputs


There are no inputs for this script.

Outputs


There are no outputs for this script.

function servicesLinux() {
  packOutput('service --status-all');
}
function servicesDarwin() {
  packOutput('launchctl list');
}
function servicesWindows() {
  pack(wmi_query('select Name,Description,PathName,StartMode,ProcessId,State,StartName from Win32_Service'), 'table');
}
try {
  if (env.OS === 'windows') {
    servicesWindows();
  } else if (env.OS === 'linux') {
    servicesLinux();
  } else {
    servicesDarwin();
  }
} catch (ex) {
  pack('Error: ' + ex);
}