Misc cleanup, comment improves, etc.

This commit is contained in:
Zack T
2024-06-17 17:12:52 -07:00
parent 1ec54d11a4
commit ab7edfde9d
4 changed files with 14 additions and 16 deletions

View File

@@ -24,7 +24,7 @@ WHERE command NOT IN (
-- Jamf Pro Product Issue: (Couldn't find the PI at the moment) -- Jamf Pro Product Issue: (Couldn't find the PI at the moment)
-- When a machine is re-enrolled, it gets a new push token and all of the remote commands -- When a machine is re-enrolled, it gets a new push token and all of the remote commands
-- associated with the old push token are supposed to be cleared out. -- associated with the old push token are supposed to be cleared out.
-- However, the this doesn't happen which is what the PI is for and the below command will clear out. -- However, this doesn't happen which is what the PI is for and the below command will clear out.
-- ***PLEASE NOTE*** Workarounds that remove objects from the mobile_device_management_commands -- ***PLEASE NOTE*** Workarounds that remove objects from the mobile_device_management_commands
-- table will leave orphan records in the mdm_command_source and mdm_command_group tables. -- table will leave orphan records in the mdm_command_source and mdm_command_group tables.
-- If you are running this workaround, the workaround for PI-009639 must be run promptly after. -- If you are running this workaround, the workaround for PI-009639 must be run promptly after.
@@ -53,7 +53,7 @@ WHERE
-- ################################################## -- ##################################################
-- Jamf Pro Product Issue: PI-009639 -- Jamf Pro Product Issue: PI-009639
-- Clean up records in the computer_user_pushtokens table -- Clean up records in the mdm_command_source and mdm_command_group tables
-- Rename the original mdm_command_source table -- Rename the original mdm_command_source table
RENAME TABLE mdm_command_source TO mdm_command_source_original; RENAME TABLE mdm_command_source TO mdm_command_source_original;

View File

@@ -260,7 +260,7 @@ SELECT
AND sites_mobiles.site_name IS NOT NULL AND sites_mobiles.site_name IS NOT NULL
) THEN sites_mobiles.site_name ) THEN sites_mobiles.site_name
ELSE "None" ELSE "None"
END AS `Device Site`, END AS "Device Site",
CASE CASE
WHEN mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER") THEN mac_denorm.computer_id WHEN mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER") THEN mac_denorm.computer_id
WHEN mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV") THEN mobile_denorm.mobile_device_id WHEN mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV") THEN mobile_denorm.mobile_device_id
@@ -275,7 +275,7 @@ SELECT
AND sites_mobile_apps.site_name IS NOT NULL AND sites_mobile_apps.site_name IS NOT NULL
) THEN sites_mobile_apps.site_name ) THEN sites_mobile_apps.site_name
ELSE "None" ELSE "None"
END AS `App Site`, END AS "App Site",
mdm_cmds.profile_id AS "App ID", mdm_cmds.profile_id AS "App ID",
CASE CASE
WHEN ( WHEN (
@@ -332,8 +332,8 @@ GROUP BY
mac_denorm.computer_id, mac_denorm.computer_id,
mdm_cmds.apns_result_status, mdm_cmds.apns_result_status,
mdm_cmds.error_localized_description, mdm_cmds.error_localized_description,
`App Site`, "App Site",
`Device Site` "Device Site"
HAVING COUNT(*) > 1 HAVING COUNT(*) > 1
ORDER BY COUNT(*) ORDER BY COUNT(*)
DESC; DESC;
@@ -354,7 +354,7 @@ SELECT
AND sites_mobiles.site_name IS NOT NULL AND sites_mobiles.site_name IS NOT NULL
) THEN sites_mobiles.site_name ) THEN sites_mobiles.site_name
ELSE "None" ELSE "None"
END AS `Device Site`, END AS "Device Site",
CASE CASE
WHEN mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER") THEN mac_denorm.computer_id WHEN mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER") THEN mac_denorm.computer_id
WHEN mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV") THEN mobile_denorm.mobile_device_id WHEN mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV") THEN mobile_denorm.mobile_device_id
@@ -369,7 +369,7 @@ SELECT
AND sites_mobile_apps.site_name IS NOT NULL AND sites_mobile_apps.site_name IS NOT NULL
) THEN sites_mobile_apps.site_name ) THEN sites_mobile_apps.site_name
ELSE "None" ELSE "None"
END AS `App Site`, END AS "App Site",
mdm_cmds.profile_id AS "App ID", mdm_cmds.profile_id AS "App ID",
CASE CASE
WHEN ( WHEN (
@@ -430,8 +430,8 @@ GROUP BY
mac_denorm.computer_id, mac_denorm.computer_id,
mdm_cmds.apns_result_status, mdm_cmds.apns_result_status,
mdm_cmds.error_localized_description, mdm_cmds.error_localized_description,
`App Site`, "App Site",
`Device Site` "Device Site"
HAVING COUNT(*) > 1 HAVING COUNT(*) > 1
ORDER BY COUNT(*) ORDER BY COUNT(*)
DESC; DESC;
@@ -479,7 +479,6 @@ FROM mobile_device_management_commands
; ;
-- ################################################## -- ##################################################
-- Get unique errors for failed "Renew MDM Profile" Commands -- Get unique errors for failed "Renew MDM Profile" Commands
SELECT distinct error_code, error_domain, error_localized_description SELECT distinct error_code, error_domain, error_localized_description

View File

@@ -16,8 +16,8 @@ WHERE
GROUP BY GROUP BY
DATE(date_sub(from_unixtime(reports.date_entered_epoch/1000), INTERVAL 1 DAY)), DATE(date_sub(from_unixtime(reports.date_entered_epoch/1000), INTERVAL 1 DAY)),
computer_id computer_id
HAVING `Inventory Reports` > 1 HAVING "Inventory Reports" > 1
ORDER BY `Inventory Reports` ORDER BY "Inventory Reports"
DESC; DESC;
@@ -146,11 +146,10 @@ SELECT username, key_pair_name, key_pair_value
FROM user_preferences FROM user_preferences
WHERE WHERE
key_pair_name = "lastSiteID" key_pair_name = "lastSiteID"
AND username = "zthomps3" AND username = "<username>"
; ;
-- ################################################## -- ##################################################
-- Get devices with attachments -- Get devices with attachments

View File

@@ -56,7 +56,7 @@ LEFT JOIN sites
-- ################################################## -- ##################################################
-- Self Service Policies -- Self Service Policies
-- Get Policies are report if they are set for Self Service and if have a Description and Icon and include it's Site -- Get Policies and report if they are set for Self Service and if they have a Description and Icon and include it's Site
SELECT SELECT
policies.policy_id AS "Policy ID", policies.policy_id AS "Policy ID",
policies.name AS "Policy Name", policies.name AS "Policy Name",