Skip to content
Create Local Admin Account on MacOS using Intune

Create Local Admin Account on MacOS using Intune

Written By Jitesh Kumar
Last Updated July 15, 2026
Posted In Intune
SHARE

In this post, you will learn how to use Shell Scripts to Create Local Admin Account on macOS using Intune. This can be especially useful for IT admins to ensure they have the necessary access and control over managed macOS devices.

By using custom macOS Shell scripts, you can automate the local account configuration of macOS devices from Intune. However, testing your scripts thoroughly and monitoring their deployment is important to ensure they do not cause disruptions.

Creating a local admin account on macOS can be helpful for various purposes, such as troubleshooting, maintenance, or as a backup administrative account, the purpose is to provide an IT Admin with ad-hoc access to macOS device when they require it.

Once you have the script ready, The script will be assigned to an Entra ID device group macOS devices are added to this group when an Admin requires access. Once the script runs, it will create the ‘Local Admin’ account. Once the IT Admin logs on to the Mac, they should change the password.

Patch My PC

Create Local Admin Account on MacOS using Intune

Let’s follow the steps for deploying Shell Scripts for macOS devices in Intune to create a local admin account. Ensure that the prerequisites are met when deploying shell scripts and assigning them to macOS devices.

  • Sign in to the Microsoft Intune admin center https://intune.microsoft.com/.
  • Navigate to Devices Scripts. Alternatively, if you want to add Shell scripts, you can also select Devices > macOS > Configuration Scripts. This will take you to the same wizard.
Create Local Admin Account on MacOS using Intune Fig.1
Create Local Admin Account on MacOS using Intune Fig.1

In Basics, You need to type the descriptive name for the Shell script (For Example, Create a Local Admin Account for macOS) and a description to get it clearer for other references and Select Next.

Create Local Admin Account on MacOS using Intune Fig.2
Create Local Admin Account on MacOS using Intune Fig.2

The createLocalAdminAccount.sh script has been provided as an example. It is strongly recommended that you spend significant time testing and modifying to suit your own needs. You can download it from the macOS Githhub repository and save it for uploading.

  • createLocalAdminAccount.sh – Script to create Local Admin Account for IT Use.
# Define variables

adminaccountname="localadmin"         # This is the accountname of the new admin
adminaccountfullname="Local Admin"  # This is the full name of the new admin user
scriptname="Create Local Admin Account"
logandmetadir="/Library/IntuneScripts/createLocalAdminAccount"
log="$logandmetadir/createLocalAdminAccount.log"
Create Local Admin Account on MacOS using Intune Fig.3
Create Local Admin Account on MacOS using Intune Fig.3

Please wait! You also have a couple of settings to be reviewed, In the Script settings, once you upload the script, you can scroll down on the same page to get the below options.

Shell Script Execution OptionsDescriptionsConfiguration
Run script as signed-in userSelect Yes to run the script with the user’s credentials on the device. Choose No (default) to run the script as the root user.No
Hide script notifications on devices By default, script notifications are shown for each script that is run. End users see a IT is configuring your computer notification from Intune on macOS devices.Yes
Script frequency Select how often the script is to be run. Choose Not configured (default) to run a script only once.Not Configured
Max number of times to retry if script failsSelect how many times the script should be run if it returns a non-zero exit code (zero meaning success). Choose Not configured (default) to not retry when a script fails.3
Table 1 – Create Local Admin Account on MacOS using Intune
Create Local Admin Account on MacOS using Intune Fig.4
Create Local Admin Account on MacOS using Intune Fig.4

You can assign Scope tags to filter the profile to specific IT groups. Add scope tags (if required) and click Next. Under Assignments, click Add groups in Included groups, then choose Select groups to include one or more groups. Click Next to continue. This should include the macOS devices for which you want to create a local admin account.

Create Local Admin Account on MacOS using Intune Fig.5
Create Local Admin Account on MacOS using Intune Fig.5

Now in Review + create, review your local admin account script settings. When you click on Create, your changes are saved, and the policy is created.

Create Local Admin Account on MacOS using Intune Fig.6
Create Local Admin Account on MacOS using Intune Fig.6

A notification will appear automatically in the top right-hand corner with a message. You can see that the Shell script was created successfully. Go to Create Local Admin Account – macOS to view the details. If you check, the script is available in the Shell scripts list.

Create Local Admin Account on MacOS using Intune Fig.7

Monitor Script Execution Status

You can monitor the progress of the profile deployment in the Intune portal to ensure that the local admin account is created successfully on the targeted macOS devices.

In the Intune Portal, Navigate to the macOS Create Local Admin Account and click on Overview or Monitoring to get the summary status. In the Monitoring workspace, click Device Status. In the Device Status list, you view the results for each script you ran on macOS devices.

Create Local Admin Account on MacOS using Intune Fig.8
Create Local Admin Account on MacOS using Intune Fig.8

End User Experience

On the targeted macOS devices, you can verify the creation of the local admin account by logging in with the account credentials specified in the profile. Ensure you have the username and password for the new local admin account.

On your Mac, choose Apple menu > System Settings, then click Users & Groups in the sidebar. Here you can find the created local admin account. Clicking on the account, you will get more details.

Create Local Admin Account on MacOS using Intune Fig.9
Create Local Admin Account on MacOS using Intune Fig.9

We are on WhatsApp. To get the latest step-by-step guides and news updates, Join our Channel. Click here –HTMD WhatsApp.

Author

About Author – JiteshMicrosoft MVP, has over six years of working experience in the IT Industry. He writes and shares his experiences related to Microsoft device management technologies and IT Infrastructure management. His primary focus is Windows 10/11 Deployment solution with Configuration Manager, Microsoft Deployment Toolkit (MDT), and Microsoft Intune.

Written by

Jitesh has over 5 years of working experience in the IT Industry. He writes and shares his experiences related to Microsoft device management technologies and IT Infrastructure management. His primary focus area is Windows 10 Deployment solution with Configuration Manager, Microsoft Deployment Toolkit (MDT), and Microsoft Intune.

Discussion · 4 comments

  1. Hello,
    Would it be ok to continue the article and show how that admins logs in and what is the admin user experience basically.
    Like, where does it get a password from?

  2. If you open terminal and paste the cypher in the script into it you will see the unique password for each machine. In the linked example (which is is recommended you change), pasting the below reveals the password created by the script:

    system_profiler SPHardwareDataType | awk ‘/Serial/ {print $4}’ | tr ‘[A-Z]’ ‘[K-ZA-J]’ | tr 0-9 4-90-3 | base64

  3. Hi,
    once the script is run and a unique password is created and used for task to complete, then where do I need to change the password for next use ?

Join the discussion

Your email address will not be published. Required fields are marked *

Related guides

Intune

Simplify Windows Devices to Run Only the Required Applications using Intune

Key Takeaways Hey, let’s learn about Simplify Windows Devices to Run Only the Required Applications using Intune. This policy lets administrators replace the default windows shell with a custom or lightweight shell. it improves performance by using system resources and is useful for devices that run a dedicated application. If the policy is disabled or […]

AC Anoop C Nair 8 min read
Intune

Enhance macOS Compliance with Custom Security and Compliance Checks to Improve Device Security using Microsoft Intune

Key Takeaways In this post we are discussing about Enhance macOS Compliance with Custom Security and Compliance Checks to Improve Device Security using Microsoft Intune. Microsoft has announced the general availability of Custom Compliance Settings for macOS in Microsoft Intune. The feature helps organizations strengthen security controls while supporting many types of macOS management scenarios. […]

AC Anoop C Nair 4 min read
Intune

Manage Samsung Galaxy Firmware Versions to Improve Security and Compliance using Microsoft Intune

Key Takeaways In this post we are discussing Manage Samsung Galaxy Firmware Versions to Improve Security and Compliance using Microsoft Intune. Microsoft Intune has received a new update that expands firmware management capabilities for Samsung Galaxy devices through Firmware Versionsintegration. This enhancement gives IT administrators more control over firmware and operating system updates, helping them […]

AC Anoop C Nair 4 min read
Intune

MS Intune Adds Windows Registry Data Collection to Device Inventory for Single Values All Key Values and Subkeys

Key Takeaways Microsoft Intune 2607 introduces Windows Registry Data collection in Device Inventory, allowing IT admins to verify actual device configurations without relying on custom discovery or remediation scripts. Using the Properties Catalog, admins can collect registry information through Single Value, All Values Under a Key (Non-Recursive), or Same Value Across Subkeys. MS Intune Adds […]

AC Anoop C Nair 5 min read