%3CLINGO-SUB%20id%3D%22lingo-sub-1273045%22%20slang%3D%22en-US%22%3EMicrosoft%20Endpoint%20Manager%20announces%20support%20for%20Apple%20Mac%20Scripting%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1273045%22%20slang%3D%22en-US%22%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EMicrosoft%20is%20excited%20to%20announce%20that%20Mac%20Scripting%20capabilities%20on%20Apple%20macOS%20are%20now%20available%20in%20public%20preview%2C%20allowing%20administrators%20to%20automate%20routine%20tasks%20on%20hundreds%20and%20thousands%20of%20devices.%20Whether%20you%20are%20a%20business%20looking%20to%20extend%20employee%20device-choice%20program%20options%20or%20simply%20bringing%20all%20device%20management%20under%20one%20solution%2C%20Microsoft%20Endpoint%20Manager%20has%20you%20covered.%20As%20most%20of%20you%20know%2C%20Microsoft%20Endpoint%20Manager%20is%20our%20new%20unified%20platform%20that%20includes%20Microsoft%20Intune%20and%20Configuration%20Manager.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EMicrosoft%20continues%20to%20invest%20in%20enterprise%20Mac%20management%20scenarios%20that%20are%20critical%20to%20businesses%20and%20employees%20choosing%20Macs.%20This%20article%20will%20explore%20how%20macOS%20management%20in%20your%20organization%20will%20benefit%20from%20the%20ease%20of%20use%2C%20accuracy%20and%20time%20savings%20over%20many%20frequently%20performed%20administrative%20tasks.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1380178960%22%20id%3D%22toc-hId--1380178960%22%3EWhy%20automation%20scripting%20matters%20for%20macOS%20administration%3C%2FH2%3E%0A%3CP%3EScripting%20is%20a%20versatile%20tool%20that%20allows%20admins%20to%20quickly%20achieve%20several%20management%20goals.%20Whether%20it%20is%20force-restarting%20a%20Mac%2C%20mounting%20a%20network%20share%2C%20deleting%20a%20user%20keychain%20or%20configuring%20the%20Dock%20or%20menu%20bar%20icons%2C%20scripting%20can%20provide%20admins%20with%20the%20ease%20of%20configuration%20and%20flexibility%20that%20they%20need%20to%20do%20their%20jobs%20well.%20%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EScripting%20for%20enrolled%20Mac%20devices%20uses%20a%20new%26nbsp%3BIntune%20MDM%20agent%20for%20macOS%2C%20which%20extends%20Mac%20management%20capabilities%20beyond%20what's%20enabled%20by%20the%20macOS%20operating%20system.%20This%20is%20a%20significant%20architectural%20change%20that%20will%20allow%20us%20to%20innovate%20faster%20and%20brings%20Mac%20management%20benefits%20to%20our%20customers.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1107333873%22%20id%3D%22toc-hId-1107333873%22%3EHelping%20you%20succeed%20by%20respecting%20end%20user%20trust%20and%20privacy%3C%2FH2%3E%0A%3CP%3EScripting%20in%20Microsoft%20Endpoint%20Manager%20is%20built%20with%20user%20trust%20in%20mind.%20The%20Intune%20MDM%20agent%20for%20Mac%20is%20only%20deployed%20on%20the%20device%20when%20scripts%20are%20assigned%20to%20the%20device.%20The%20MDM%20agent%20removes%20itself%20from%20the%20device%20if%20scripts%20are%20not%20assigned%20to%20the%20device%20or%20the%20agent%20is%20unable%20to%20connect%20to%20the%20Intune%20service%20for%2024%20hours%20of%20device-awake%20time.%20This%20way%2C%20Microsoft%20Endpoint%20Manager%20helps%20administrators%20efficiently%20run%20the%20tasks%20needed%20to%20protect%20the%20organization's%20data%20and%20assets%20and%20does%20not%20outstay%20its%20welcome%20on%20the%20end-user%E2%80%99s%20device.%20Based%20on%20in-depth%20customer%20research%2C%20we%20believe%20that%20this%20fosters%20necessary%20trust%20between%20IT%20systems%20and%20end-users%20for%20successful%20digital%20transformation.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--700120590%22%20id%3D%22toc-hId--700120590%22%3EArchitectural%20overview%3C%2FH2%3E%0A%3CP%3EYou%20are%20probably%20curious%20about%20how%20it%20works%20behind%20the%20scenes.%20At%20a%20high-level%2C%20the%20scripting%20workflow%20is%20as%20follows%3A%3C%2FP%3E%0A%3CDIV%20id%3D%22tinyMceEditorMayunk%20Jain_0%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22mac%20script%20001.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F181411i432CFB2A507163D0%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22mac%20script%20001.png%22%20alt%3D%22Overview%20of%20Mac%20scripting%20with%20Intune%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EOverview%20of%20Mac%20scripting%20with%20Intune%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%20you%20create%20a%20shell%20script%20and%20assign%20it%20to%20an%20Azure%20AD%20device%20group%2C%20an%20app%20deployment%20for%20Intune%20MDM%20agent%20is%20automatically%20created%20in%20the%20background%20with%20matching%20group%20assignments.%20The%20agent%20app%20is%20not%20visible%20to%20the%20admin%20in%20the%20list%20of%20apps.%20When%20the%20macOS%20devices%20within%20the%20assigned%20group%20sync%20with%20Microsoft%20Intune%20service%2C%20they%20receive%20the%20Intune%20MDM%20agent%20app%20deployment%20and%20it%20is%20silently%20installed%20on%20the%20Mac%20with%20no%20user%20interaction.%20Once%20installed%2C%20the%20agent%20establishes%20a%20secure%20link%20with%20the%20Intune%20service%20to%20receive%20the%20shell%20scripts.%20The%20agent%20then%20starts%20receiving%20assigned%20shell%20script%20policies%20along%20with%20the%20IT-configured%20script%20settings.%20The%20scripts%20are%20executed%20on%20the%20macOS%20and%20the%20result%20status%20sent%20back%20to%20Intune%20service.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EEach%20script%20is%20run%20as%20a%20separate%20process%20and%20the%20status%20is%20reported%20to%20Intune%20service%20so%20that%20IT%20admins%20can%20monitor%20successful%20execution%20and%20error%20codes%20of%20the%20script%20from%20the%20admin%20center.%20If%20the%20scripts%20are%20meant%20to%20be%20run%20on%20a%20pre-set%20frequency%20configured%20by%20admins%2C%20the%20scripts%20are%20stored%20locally%20on%20the%20Mac%20and%20re-run%20as%20needed.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOur%20scripting%20capabilities%20allow%20admins%20to%20deploy%20any%20type%20of%20script%20that%20starts%20with%20%23!%20(colloquially%20known%20as%20%22shebang%22)%20and%20can%20be%20run%20on%20macOS%20with%20the%20appropriate%20interpreters%20pre-installed.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CIFRAME%20src%3D%22https%3A%2F%2Fwww.youtube.com%2Fembed%2FXZ0KBYxw3nA%22%20width%3D%22560%22%20height%3D%22315%22%20frameborder%3D%220%22%20allowfullscreen%3D%22allowfullscreen%22%20allow%3D%22accelerometer%3B%20autoplay%3B%20encrypted-media%3B%20gyroscope%3B%20picture-in-picture%22%3E%3C%2FIFRAME%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1787392243%22%20id%3D%22toc-hId-1787392243%22%3EHow%20to%20use%20scripts%20in%20Microsoft%20Endpoint%20Manager%3C%2FH2%3E%0A%3CP%3ENow%20let%E2%80%99s%20have%20a%20quick%20walk-through%20and%20see%20how%20it%20works.%20Check%20out%20%E2%80%9Cshell%20scripts%E2%80%9D%20for%20macOS%20by%20logging%20in%20to%20%3CA%20href%3D%22https%3A%2F%2Fendpoint.microsoft.com%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EMicrosoft%20Endpoint%20Manager%20Admin%20Center%3C%2FA%3E%20and%20navigating%20to%20%3CSTRONG%3EDevices%20%26gt%3B%20macOS%20%26gt%3B%20Shell%20scripts%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22mac%20script%20002.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F181412i9F571B9659E925E6%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22mac%20script%20002.png%22%20alt%3D%22mac%20script%20002.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20configure%20the%20following%20settings%20for%20each%20script%20to%20suit%20your%20needs%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EUpload%20script%3A%3C%2FSTRONG%3E%20any%20script%20that%20begins%20with%20%23!%20and%20point%20to%20a%20valid%20location%20(such%20as%20%23!%2Fbin%2Fsh%20or%20%23!%2Fusr%2Fbin%2Fenv%20zsh)%20can%20be%20uploaded.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3ERun%20script%20as%20signed-in%20user%3A%3C%2FSTRONG%3E%20by%20default%2C%20the%20script%20runs%20as%20root%20user.%20But%20you%20can%20choose%20to%20run%20the%20script%20as%20the%20signed-in%20user.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EHide%20script%20notifications%20on%20devices%3A%3C%2FSTRONG%3E%20by%20default%2C%20script%20notifications%20are%20shown%20for%20each%20script%20on%20run.%20End%20users%20see%20%3CEM%3E%E2%80%9CIT%20is%20configuring%20your%20computer%E2%80%9D%3C%2FEM%3E%20notification%20from%20Intune%20Company%20Portal%20on%20macOS%20devices.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EScript%20frequency%3A%3C%2FSTRONG%3E%20by%20default%2C%20scripts%20are%20run%20only%20once.%20You%20can%20choose%20how%20frequently%20a%20script%20is%20run%20on%20a%20device%20using%20this%20setting.%20Your%20choices%20are%20every%2015%20minutes%2C%2030%20minutes%2C%201%20hour%2C%202%20hours%2C%203%20hours%2C%206%20hours%2C%2012%20hours%2C%201%20day%20or%201%20week.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EMax%20number%20of%20times%20to%20retry%20if%20script%20fails%3A%3C%2FSTRONG%3E%20by%20default%2C%20scripts%20are%20run%20only%20once.%20A%20script%20is%20considered%20to%20have%20failed%20if%20it%20returns%20a%20non-zero%20exit%20code%20on%20run.%20In%20case%20of%20failures%2C%20you%20can%20choose%20to%20automatically%20retry%20a%20script-run%20up%20to%20three%20times.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22mac%20script%20003a.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F181418iFFD00ABF4A71C876%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22mac%20script%20003a.png%22%20alt%3D%22mac%20script%20003a.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOnce%20you%20have%20uploaded%20your%20script%20and%20configured%20the%20script%20settings%2C%20you%20can%20assign%20it%20to%20Azure%20AD%20device%20groups.%20For%20example%2C%20to%20assign%20a%20script%20to%20all%20Mac%20devices%20enrolled%20using%20a%20specific%20DEP%20enrollment%20profile%2C%20you%20can%20create%20an%20Azure%20AD%20security%20group%20and%20set%20the%20dynamic%20device%20membership%20rule%20to%20filter%20by%20enrollmentProfileName%20property.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOnce%20the%20script%20has%20run%20on%20the%20device%2C%20it%20reports%20status%20back%20to%20Microsoft%20Endpoint%20Manager%20at%20%3CSTRONG%3EDevices%20%26gt%3B%20macOS%20%26gt%3B%20Shell%20scripts%20%26gt%3B%20select%20assigned%20script%20%26gt%3B%20Device%20status%20%3C%2FSTRONG%3Eor%3CSTRONG%3E%20User%20status%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22mac%20script%20004.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F181415i42136D28F480DA43%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22mac%20script%20004.png%22%20alt%3D%22mac%20script%20004.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--20062220%22%20id%3D%22toc-hId--20062220%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22toc-hId--1827516683%22%20id%3D%22toc-hId--1827516683%22%3ENext%20steps%3C%2FH2%3E%0A%3CP%3EWe%20heard%20from%20several%20customers%20that%20automation%20scripting%20is%20an%20important%20capability%20for%20macOS%20management%2C%20and%20we%20decided%20to%20support%20this%20as%20the%20first%20capability%20using%20the%20new%20Intune%20MDM%20agent%20for%20macOS.%20Based%20on%20%3CA%20href%3D%22https%3A%2F%2Fmicrosoftintune.uservoice.com%2Fforums%2F291681-ideas%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ecustomer%20feedback%3C%2FA%3E%2C%20we%20have%20plans%20to%20support%20more%20capabilities%20in%20future.%20Over%20the%20last%20few%20months%2C%20Microsoft%20Endpoint%20Manager%20has%20made%20exponential%20strides%20in%20expanding%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fenterprise-mobility-security%2Fmicrosoft-intune-expands-macos-app-management-support%2Fba-p%2F956124%22%20target%3D%22_blank%22%3EMac%20app%20management%20capabilities%3C%2FA%3E%20including%20Apple%20volume-purchased%20(VPP)%20apps%20support%20on%20macOS%2C%2064-bit%20macOS%20support%20for%20the%20app%20wrapping%20tool%2C%20web%20clip%20installation%20to%20Dock%2C%20and%20scale%20improvements%20to%20support%20up%20to%203%2C000%20Apple%20VPP%20tokens.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20have%20not%20been%20managing%20Macs%20so%20far%2C%20this%20is%20a%20great%20opportunity%20for%20you%20to%20experience%20the%20power%20of%20unified%20endpoint%20management%20from%20a%20single%20console%20using%20Microsoft%20Endpoint%20Manager.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ECheck%20out%20the%20technical%20documentation%20for%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fmem%2Fintune%2Fapps%2Fmacos-shell-scripts%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Eshell%20scripts%20for%20macOS%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20stay%20updated%20on%20scripting%20and%20other%20new%20features%20in%20Intune%2C%20check%20out%20our%20product%20documentation%20and%20bookmark%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fmem%2Fintune%2Ffundamentals%2Fwhats-new%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EWhat%E2%80%99s%20new%20in%20Microsoft%20Intune%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFollow%20%3CA%20href%3D%22https%3A%2F%2Fwww.twitter.com%2Fmsintune%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%40MSIntune%3C%2FA%3E%26nbsp%3Bon%20twitter%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EAuthored%20in%20collaboration%20with%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Farnabbiswas%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EArnab%20Biswas%3C%2FA%3E%2C%20Program%20Manager%2C%20Microsoft%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1273045%22%20slang%3D%22en-US%22%3E%3CP%3EMicrosoft%20is%20excited%20to%20announce%20that%20Mac%20Scripting%20capabilities%20on%20Apple%20macOS%20are%20now%20available%20in%20public%20preview%2C%20allowing%20administrators%20to%20automate%20routine%20tasks%20on%20hundreds%20and%20thousands%20of%20devices.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22macOS%20Microsoft-155.jpg%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F181410i17CC82C9D738E690%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22macOS%20Microsoft-155.jpg%22%20alt%3D%22macOS%20Microsoft-155.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1273045%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMicrosoft%20Endpoint%20Manager%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMicrosoft%20Intune%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

 

Microsoft is excited to announce that Mac Scripting capabilities on Apple macOS are now available in public preview, allowing administrators to automate routine tasks on hundreds and thousands of devices. Whether you are a business looking to extend employee device-choice program options or simply bringing all device management under one solution, Microsoft Endpoint Manager has you covered. As most of you know, Microsoft Endpoint Manager is our new unified platform that includes Microsoft Intune and Configuration Manager.

 

Microsoft continues to invest in enterprise Mac management scenarios that are critical to businesses and employees choosing Macs. This article will explore how macOS management in your organization will benefit from the ease of use, accuracy and time savings over many frequently performed administrative tasks.

 

Why automation scripting matters for macOS administration

Scripting is a versatile tool that allows admins to quickly achieve several management goals. Whether it is force-restarting a Mac, mounting a network share, deleting a user keychain or configuring the Dock or menu bar icons, scripting can provide admins with the ease of configuration and flexibility that they need to do their jobs well.  

 

Scripting for enrolled Mac devices uses a new Intune MDM agent for macOS, which extends Mac management capabilities beyond what's enabled by the macOS operating system. This is a significant architectural change that will allow us to innovate faster and brings Mac management benefits to our customers.

 

Helping you succeed by respecting end user trust and privacy

Scripting in Microsoft Endpoint Manager is built with user trust in mind. The Intune MDM agent for Mac is only deployed on the device when scripts are assigned to the device. The MDM agent removes itself from the device if scripts are not assigned to the device or the agent is unable to connect to the Intune service for 24 hours of device-awake time. This way, Microsoft Endpoint Manager helps administrators efficiently run the tasks needed to protect the organization's data and assets and does not outstay its welcome on the end-user’s device. Based on in-depth customer research, we believe that this fosters necessary trust between IT systems and end-users for successful digital transformation.

 

Architectural overview

You are probably curious about how it works behind the scenes. At a high-level, the scripting workflow is as follows:

 

Overview of Mac scripting with IntuneOverview of Mac scripting with Intune

 

 

When you create a shell script and assign it to an Azure AD device group, an app deployment for Intune MDM agent is automatically created in the background with matching group assignments. The agent app is not visible to the admin in the list of apps. When the macOS devices within the assigned group sync with Microsoft Intune service, they receive the Intune MDM agent app deployment and it is silently installed on the Mac with no user interaction. Once installed, the agent establishes a secure link with the Intune service to receive the shell scripts. The agent then starts receiving assigned shell script policies along with the IT-configured script settings. The scripts are executed on the macOS and the result status sent back to Intune service.

 

Each script is run as a separate process and the status is reported to Intune service so that IT admins can monitor successful execution and error codes of the script from the admin center. If the scripts are meant to be run on a pre-set frequency configured by admins, the scripts are stored locally on the Mac and re-run as needed.

 

Our scripting capabilities allow admins to deploy any type of script that starts with #! (colloquially known as "shebang") and can be run on macOS with the appropriate interpreters pre-installed.

 

 

 

How to use scripts in Microsoft Endpoint Manager

Now let’s have a quick walk-through and see how it works. Check out “shell scripts” for macOS by logging in to Microsoft Endpoint Manager Admin Center and navigating to Devices > macOS > Shell scripts.

 

mac script 002.png

 

You can configure the following settings for each script to suit your needs:

    • Upload script: any script that begins with #! and point to a valid location (such as #!/bin/sh or #!/usr/bin/env zsh) can be uploaded.
    • Run script as signed-in user: by default, the script runs as root user. But you can choose to run the script as the signed-in user.
    • Hide script notifications on devices: by default, script notifications are shown for each script on run. End users see “IT is configuring your computer” notification from Intune Company Portal on macOS devices.
    • Script frequency: by default, scripts are run only once. You can choose how frequently a script is run on a device using this setting. Your choices are every 15 minutes, 30 minutes, 1 hour, 2 hours, 3 hours, 6 hours, 12 hours, 1 day or 1 week.
    • Max number of times to retry if script fails: by default, scripts are run only once. A script is considered to have failed if it returns a non-zero exit code on run. In case of failures, you can choose to automatically retry a script-run up to three times.

 

mac script 003a.png

 

Once you have uploaded your script and configured the script settings, you can assign it to Azure AD device groups. For example, to assign a script to all Mac devices enrolled using a specific DEP enrollment profile, you can create an Azure AD security group and set the dynamic device membership rule to filter by enrollmentProfileName property.

 

Once the script has run on the device, it reports status back to Microsoft Endpoint Manager at Devices > macOS > Shell scripts > select assigned script > Device status or User status.

 

mac script 004.png

 

Next steps

We heard from several customers that automation scripting is an important capability for macOS management, and we decided to support this as the first capability using the new Intune MDM agent for macOS. Based on customer feedback, we have plans to support more capabilities in future. Over the last few months, Microsoft Endpoint Manager has made exponential strides in expanding Mac app management capabilities including Apple volume-purchased (VPP) apps support on macOS, 64-bit macOS support for the app wrapping tool, web clip installation to Dock, and scale improvements to support up to 3,000 Apple VPP tokens.

 

If you have not been managing Macs so far, this is a great opportunity for you to experience the power of unified endpoint management from a single console using Microsoft Endpoint Manager.

 

Check out the technical documentation for shell scripts for macOS

 

To stay updated on scripting and other new features in Intune, check out our product documentation and bookmark What’s new in Microsoft Intune.

 

Follow @MSIntune on twitter

 

Authored in collaboration with Arnab Biswas, Program Manager, Microsoft