# Make Intune macOS shell scripts safe for parallel and repeated execution

> Can a macOS management script tolerate concurrent runs and the chosen user context?

- Canonical URL: https://update.dsesecurity.com/updates/dse-20260909-196-make-intune-macos-shell-scripts-safe-for-parallel-and-repeated-execution/
- Publisher: Detection Systems & Engineering (DSE Security)
- Author: DSE Security Editorial Team
- Published: 2026-09-10T00:28:40+00:00
- Modified: 2026-09-10T00:55:36+00:00
- Last reviewed by DSE: 2026-09-09
- Resource type: Guide
- DSE priority: Information
- Topics: Business Continuity, IT
- Reading time: 2 minutes

## What you need to know

Can a macOS management script tolerate concurrent runs and the chosen user context?

## Potentially affected

Confirm supported macOS, the installed management agent, and the required shell interpreter. Determine whether the proposed action belongs to the device or to each signed-in user before choosing execution context.

## DSE recommendation

Review the script for repeated side effects, shared temporary paths, and assumptions that another script has already finished.

## Article

## Source facts

Intune runs macOS shell scripts as separate parallel processes. A script configured for signed-in users runs for every currently signed-in account, while the default setting runs as root. Certain conditions can trigger runs more frequently than the selected frequency. Scripts exceeding 60 minutes are stopped and reported failed. Microsoft requires direct internet connectivity; proxy connections are unsupported. [Microsoft Learn](https://learn.microsoft.com/en-us/intune/device-management/tools/run-shell-scripts-macos).

## Applicability

Confirm supported macOS, the installed management agent, and the required shell interpreter. Determine whether the proposed action belongs to the device or to each signed-in user before choosing execution context.

## DSE recommendation

Review the script for repeated side effects, shared temporary paths, and assumptions that another script has already finished. Require an explicit reason for root execution. Design state checks so an already-correct device needs no further change, and define a clear exit result when a prerequisite is absent. Avoid making one independent assignment a hidden prerequisite for another.

## Verification

Rehearse the script on a test Mac with representative account and sign-in conditions. Run the intended operation again and check for duplicate configuration, unintended file changes, or conflicting concurrent activity. Compare the script’s exit result with the actual requested state; a zero exit code alone should not be the team’s acceptance criterion. Keep sanitized local evidence and the reviewed script version with the deployment record.

## Official references

[Microsoft Learn: Use Shell Scripts on macOS Devices in Microsoft Intune](https://learn.microsoft.com/en-us/intune/device-management/tools/run-shell-scripts-macos).

## Primary reference

- Name: Use Shell Scripts on macOS Devices in Microsoft Intune - Microsoft Intune | Microsoft Learn
- Authority: Microsoft Learn
- URL: https://learn.microsoft.com/en-us/intune/device-management/tools/run-shell-scripts-macos
- Source publication date: Not stated by the source

## Citation and use

Preferred citation: “Make Intune macOS shell scripts safe for parallel and repeated execution,” DSE Security, https://update.dsesecurity.com/updates/dse-20260909-196-make-intune-macos-shell-scripts-safe-for-parallel-and-repeated-execution/
Publishing principles: https://update.dsesecurity.com/updates/dse-updates-editorial-methodology/
Usage and citation policy: https://update.dsesecurity.com/usage/
Copyright © 2026 Detection Systems & Engineering. All rights reserved.
