Skip to content

Microsoft SCCM / MECM Executor

Category: Patch Management Script: sccm.py Integration: REST API (AdminService) Faraday Plugin: Raw JSON Website: https://learn.microsoft.com/en-us/mem/configmgr/develop/adminservice/usage

Description

Imports missing Windows updates from Microsoft Configuration Manager (SCCM / MECM) into Faraday. Each managed system becomes a host and each missing update becomes a vulnerability prefixed with [PATCH-MGMT].

Prerequisites

  • A Configuration Manager site with the AdminService REST endpoint published (on the SMS Provider, usually the primary site server)
  • A service account that can read the Configuration Manager WMI classes through AdminService. Use DOMAIN\user or user@DOMAIN format for domain accounts.
  • Network access from the agent to SCCM_HOST
  • Optional: the requests_ntlm Python package in the agent environment, for servers that require NTLM authentication

Configuration

Environment Variables (Setup)

Variable Required Description
SCCM_HOST Yes AdminService server URL including scheme (e.g., https://sccm.example.com)
SCCM_USER Yes Service account name (e.g., DOMAIN\svc_faraday or svc_faraday@domain.local)
SCCM_PASSWORD Yes Service account password

These variables are also accepted as execution arguments, so a single run can override them.

Execution Arguments

Parameter Type Mandatory Description
SCCM_SITE_CODE string No 3-character site code (e.g., PRI) to import only the systems assigned to that site. Default: all sites the account can see.
SCCM_COLLECTION_ID string No 8-character collection ID (e.g., SMS00001 for All Systems) to import only the members of that collection. Default: all systems.
SCCM_MIN_SEVERITY string No Minimum severity of updates to import: info, low, medium, high or critical (default: info)

YAML Configuration Example

executors:
  sccm:
    repo_executor: sccm.py
    max_size: 65536
    varenvs:
      SCCM_HOST: "https://sccm.example.com"
      SCCM_USER: "DOMAIN\\svc_faraday"
      SCCM_PASSWORD: "<sccm_password>"
    params:
      SCCM_SITE_CODE:
        mandatory: false
        type: string
        base: string
      SCCM_COLLECTION_ID:
        mandatory: false
        type: string
        base: string
      SCCM_MIN_SEVERITY:
        mandatory: false
        type: string
        base: string

How It Works

  1. Authenticates with SCCM_USER and SCCM_PASSWORD using HTTP Basic, and also with NTLM when requests_ntlm is installed
  2. When SCCM_COLLECTION_ID is set, reads the collection members from /AdminService/wmi/SMS_FullCollectionMembership
  3. Reads the managed systems from /AdminService/wmi/SMS_R_System, optionally limited to SCCM_SITE_CODE and the collection members
  4. Reads the missing updates of each system from /AdminService/wmi/SMS_UpdateComplianceStatus, then resolves their details from /AdminService/wmi/SMS_SoftwareUpdate
  5. Creates one vulnerability per missing update, with the update title as name (prefixed with [PATCH-MGMT]), severity from the update's severity or CVSS score, and its CVEs and KB articles as references

Notes

  • Each system becomes a host with its first reported IP (or 0.0.0.0 when none), hostname, MAC address and operating system. Systems with no missing updates are still imported as hosts.
  • If no systems are found, a single placeholder host named after the collection, site code or sccm is created.
  • The executor queries the compliance status of each system separately, so large sites take longer.
  • SCCM_HOST must start with http:// or https:// (e.g., https://sccm.example.com). SCCM_SITE_CODE and SCCM_COLLECTION_ID are validated and the run stops when they are malformed.
  • An unrecognized SCCM_MIN_SEVERITY falls back to info.
  • The shared agent parameters (AGENT_CONFIG_* tags and severity filters) are not applied by this executor. Use SCCM_MIN_SEVERITY to filter by severity.