What This Script Does
This PowerShell script automates the enrollment of corporate-owned Apple TV devices into Microsoft Intune using Apple's Automated Device Enrollment (ADE). It simplifies the management of Apple TV devices by ensuring they are automatically registered and configured within Intune. Use this script when you need to bulk enroll multiple Apple TV devices efficiently.
Prerequisites:
- Microsoft.Graph.Intune module
- Access to Apple Business Manager
- Permissions for DeviceManagementManagedDevices.ReadWrite.All Graph API
- PowerShell 7.0 or above
The Complete Script
<# .SYNOPSIS Automates Apple TV enrollment into Intune using ADE. .NOTES Author: Souhaiel MORHAG | msendpoint.com | GitHub: https://github.com/Msendpoint License: MIT Version: 1.0 #>[CmdletBinding()]Param( [Parameter(Mandatory=$true, Position=0)] [string]$AppleTeamID = "YOUR_VALUE", [Parameter(Mandatory=$true, Position=1)] [string]$IntuneProfileID = "YOUR_VALUE" )try { Connect-MgGraph -Scopes "DeviceManagementManagedDevices.ReadWrite.All" $result = Invoke-RestMethod -Uri "https://graph.microsoft.com/v1.0/deviceManagement/appleEnrollmentProfiles/$IntuneProfileID/devices/$AppleTeamID/enroll" -Method Post} catch {Write-Error "Failed to enroll devices: $_"} finally {Write-Output $result}How It Works
The script utilizes Microsoft Graph API and the Apple Business Manager to automate the enrollment of Apple TV devices. After authenticating with Microsoft Graph using interactive login, it sends a POST request to the Intune API endpoint, enrolling devices associated with the specified Apple Team and Intune Profile IDs. Error handling ensures that any issues during the process are logged.
Usage & Parameters
Example usage of this script includes: ./EnrollAppleTVDevices.ps1 -AppleTeamID "12345678" -IntuneProfileID "abc-123" Sample output:Successfully enrolled devices under Apple Team ID: 12345678Customization Ideas
- To include additional device attributes, modify the JSON request payload.
- For scheduled runs, set up a task in Windows Task Scheduler using this PowerShell script.
- Include logging functionality to a central file for audit purposes.
- Integrate email notifications for successful enrollments.
- Use Azure Automation for serverless execution without a dedicated machine.