USS-IT / Jamf2Snipe

Import and sync assets from a JAMFPro instance to Snipe-IT asset management.
MIT License
0 stars 0 forks source link

Sync "MDM Capable Users" (or most applicable users field) from JAMF with Snipe-It #4

Open mcarras8 opened 8 months ago

Zigmoparcheesi commented 5 months ago

Shows the most active user for that system

mcarras8 commented 1 month ago

Looks like "group accounts local_accounts user name" and "group accounts local_accounts user realname" may be our best bet to capture all users. Either way, we would likely need to modify the jamf2snipe script to concatenate the array into something like a semi-colon delimited string. Below is an example output from the JAMF Classic API:

{
  "general": {
    "id": 1,
    "name": "Admins iMac",
    "mac_address": "E0:AC:CB:97:36:G4",
    "network_adapter_type": "Ethernet",
    "alt_mac_address": "E0:AC:CB:97:36:G4",
    "alt_network_adapter_type": "IEEE80211",
    "ip_address": "10.1.1.1",
    "last_reported_ip": "192.0.0.1",
    "serial_number": "C02Q7KHTGFWF",
    "udid": "55900BDC-347C-58B1-D249-F32244B11D30",
    "jamf_version": "9.99.0-t1494340586",
    "platform": "Mac",
    "barcode_1": "string",
    "barcode_2": "string",
    "asset_tag": "string",
    "remote_management": {
      "managed": true,
      "management_username deprecated=\"10.48\"": "deprecated"
    },
    "mdm_capable": true,
    "mdm_capable_users": {
      "mdm_capable_user": "string"
    },
    "management_status": {
      "enrolled_via_dep": true,
      "user_approved_enrollment": true,
      "user_approved_mdm": true
    },
    "report_date": "2017-07-07T18:37:04.000Z",
    "report_date_epoch": 1499470624555,
    "report_date_utc": "2017-07-07T18:37:04.555-0500",
    "last_contact_time": "2017-07-07T18:37:04.000Z",
    "last_contact_time_epoch": 1499470624555,
    "last_contact_time_utc": "2017-07-07T18:37:04.555-0500",
    "initial_entry_date": "2017-07-07T18:37:04.000Z",
    "initial_entry_date_epoch": 1499470624555,
    "initial_entry_date_utc": "2017-07-07T18:37:04.555-0500",
    "last_cloud_backup_date_epoch": 1499470624555,
    "last_cloud_backup_date_utc": "2017-07-07T18:37:04.555-0500",
    "last_enrolled_date_epoch": 1499470624555,
    "last_enrolled_date_utc": "2017-07-07T18:37:04.555-0500",
    "distribution_point": "string",
    "sus": "string",
    "site": {
      "id": -1,
      "name": "None"
    },
    "itunes_store_account_is_active": true
  },
  "location": {
    "username": "JBetty",
    "realname": "Betty Jackson",
    "real_name": "Betty Jackson",
    "email_address": "jbetty@company.com",
    "position": "Systems Engineer",
    "phone": "123-555-6789",
    "phone_number": "123-555-6789",
    "department": "Sales Staff",
    "building": "New York Office",
    "room": 1159
  },
  "purchasing": {
    "is_purchased": true,
    "is_leased": true,
    "po_number": "string",
    "vendor": "string",
    "applecare_id": "string",
    "purchase_price": "string",
    "purchasing_account": "string",
    "po_date": "string",
    "po_date_epoch": 0,
    "po_date_utc": "string",
    "warranty_expires": "string",
    "warranty_expires_epoch": 0,
    "warranty_expires_utc": "string",
    "lease_expires": "string",
    "lease_expires_epoch": 0,
    "lease_expires_utc": "string",
    "life_expectancy": 0,
    "purchasing_contact": "string"
  },
  "peripherals": {
    "size": 1,
    "peripherals": [
      {
        "peripheral": {
          "id": 1,
          "bar_code_1": "string",
          "bar_code_2": "string",
          "type": "Peripheral Type Name",
          "fields": {
            "field": {
              "name": "Peripheral Field Name",
              "value": "Value for menu type"
            }
          }
        },
        "purchasing": {
          "is_purchased": true,
          "is_leased": true,
          "po_number": "string",
          "vendor": "string",
          "applecare_id": "string",
          "purchase_price": "string",
          "purchasing_account": "string",
          "po_date": "string",
          "po_date_epoch": 0,
          "po_date_utc": "string",
          "warranty_expires": "string",
          "warranty_expires_epoch": 0,
          "warranty_expires_utc": "string",
          "lease_expires": "string",
          "lease_expires_epoch": 0,
          "lease_expires_utc": "string",
          "life_expectancy": 0,
          "purchasing_contact": "string"
        },
        "attachments": [
          {
            "size": 1,
            "attachment": {
              "id": 1,
              "filename": "icon.png",
              "uri": "https://example.jamfcloud/attachment.html?id=1&o=r"
            }
          }
        ]
      }
    ]
  },
  "hardware": {
    "make": "Apple",
    "model": "13-inch Retina MacBook Pro (Late 2013)",
    "model_identifier": "MacBookPro11,1",
    "os_name": "Mac OS X",
    "os_version": "10.13.2",
    "os_build": "17C88",
    "master_password_set": true,
    "active_directory_status": "AD.company.com",
    "service_pack": "string",
    "processor_type": "Intel Core i5",
    "processor_architechture": "x86_64",
    "processor_speed": 2600,
    "processor_speed_mhz": 2600,
    "number_processors": 1,
    "number_cores": 2,
    "total_ram": 16384,
    "total_ram_mb": 16384,
    "boot_rom": "MBP111.0142.B00",
    "bus_speed": 0,
    "bus_speed_mhz": 0,
    "battery_capacity": 90,
    "cache_size": 3072,
    "cache_size_kb": 3072,
    "available_ram_slots": 0,
    "optical_drive": "string",
    "nic_speed": "n/a",
    "smc_version": "2.16f68",
    "ble_capable": true,
    "sip_status": "Enabled",
    "gatekeeper_status": "App Store and identified developers",
    "xprotect_version": 2098,
    "institutional_recovery_key": "Not Present",
    "disk_encryption_configuration": "Individual and Institutional Encryption",
    "filevault_2_users": [
      {
        "user": "admin"
      }
    ],
    "storage": [
      {
        "device": {
          "disk": "disk0",
          "model": "Apple SSD SM0512F",
          "revision": "UXM2JA1Q",
          "serial_number": "S1K5NYADC12934",
          "size": 512287,
          "drive_capacity_mb": 512287,
          "connection_type": "NO",
          "smart_status": "Verified",
          "partition": [
            {
              "name": "Macintosh HD",
              "size": 94128,
              "type": "boot",
              "partition_capacity_mb": 94128,
              "percentage_full": 17,
              "filevault_status": "Encrypted",
              "filevault_percent": 100,
              "filevault2_status": "Encrypted",
              "filevault2_percent": 100,
              "boot_drive_available_mb": 425198,
              "lvgUUID": "string",
              "lvUUID": "string",
              "pvUUID": "string"
            }
          ]
        }
      }
    ],
    "mapped_printers": [
      {
        "printer": {
          "name": "2nd Floor HP",
          "uri": "lpd://10.11.182.21/",
          "type": "HP LaserJet 500 color MFP M575",
          "location": "2nd Floor / Stairwell"
        }
      }
    ]
  },
  "certificates": [
    {
      "certificate": {
        "common_name": "JSS Built-in Certificate Authority",
        "identify": false,
        "expires_utc": "2024-03-02T02:12:49.000+0000",
        "expires_epoch": 1709345569000,
        "name": "string"
      }
    }
  ],
  "security": {
    "activation_lock": false,
    "recovery_lock_enabled": false,
    "secure_boot_level": "unknown",
    "external_boot_level": "unknown",
    "firewall_enabled": false
  },
  "software": {
    "unix_executables": "string",
    "licensed_software": [
      {
        "name": "Adobe CS5"
      }
    ],
    "installed_by_casper": [
      {
        "package": "FireFox.pkg"
      }
    ],
    "installed_by_installer_swu": [
      {
        "package": "com.apple.pkg.iTunesX"
      }
    ],
    "cached_by_casper": [
      {
        "package": "GoogleChrome.pkg"
      }
    ],
    "available_software_updates": [
      {
        "name": "iTunesXPatch-12.7.3"
      }
    ],
    "available_updates": [
      {
        "update": {
          "name": "iTunes",
          "package_name": "iTunesXPatch-12.7.3",
          "version": "12.7.3"
        }
      }
    ],
    "running_services": [
      {
        "name": "com.apple.airportd"
      }
    ],
    "applications": [
      {
        "size": 1,
        "application": {
          "name": "Activity Monitor.app",
          "path": "/Applications/Utilities/Activity Monitor.app",
          "version": 10.13
        }
      }
    ],
    "fonts": [
      {
        "size": 1,
        "font": {
          "name": "Al Nile.ttc",
          "path": "/Library/Fonts/Al Nile.ttc",
          "version": "n/a"
        }
      }
    ],
    "plugins": [
      {
        "size": 1,
        "plugin": {
          "name": "QuickTime Plugin.plugin",
          "path": "/Library/Internet Plug-Ins/Disabled Plug-Ins/QuickTime Plugin.plugin",
          "version": "7.7.3"
        }
      }
    ]
  },
  "extension_attributes": [
    {
      "extension_attribute": {
        "id": 1,
        "name": "Battery Cycle Count",
        "type": "String",
        "value": 191
      }
    }
  ],
  "groups_accounts": {
    "computer_group_memberships": [
      {
        "group": "All Managed Clients"
      }
    ],
    "local_accounts": [
      {
        "user": {
          "name": "_amavisd",
          "realname": "AMaViS Daemon",
          "uid": 83,
          "home": "/var/virusmails",
          "home_size": "-1MB",
          "home_size_mb": -1,
          "administrator": false,
          "filevault_enabled": false
        }
      }
    ]
  },
  "configuration_profiles": [
    {
      "size": 1,
      "configuration_profile": {
        "id": 1,
        "name": "string",
        "uuid": "string",
        "is_removable": false
      }
    }
  ]
}