A collection of PowerShell scripts for automating Microsoft Intune device management tasks.
Quick Start β’ Scripts β’ Prerequisites β’ Contributing β’ Website
This repository contains PowerShell scripts designed to help IT administrators automate common Microsoft Intune management operations. All scripts use the Microsoft Graph API and are organized by functional category for easy discovery and use.
- π± Device Management: Automated device operations and lifecycle management
- π Security & Compliance: Automated compliance reporting and security operations
- π¦ Application Management: Streamlined app deployment and management
- π Monitoring & Reporting: Comprehensive monitoring and analytics tools
- βοΈ Azure Integration: Native support for Azure Automation runbooks
- π Security-First: Built with enterprise security best practices
The simplest way to use these scripts is to download and run them locally:
- π₯ Download the scripts you need from this repository
- π¦ Install required modules (the scripts will prompt you if needed)
βΆοΈ Run the scripts directly from PowerShell with appropriate parameters- π Review the output and logs for results
Most scripts are designed to work immediately without additional setup beyond the required PowerShell modules.
Example:
# Download a script and run it
.\Get-DeviceComplianceReport.ps1 -TenantId "your-tenant-id"
For scheduling, unattended execution, or more complex automation, you can deploy these scripts as Azure Automation Runbooks:
Create a User Assigned Managed Identity in your Azure tenant through the Azure Portal.
Use our setup script to grant necessary Microsoft Graph permissions:
# Grant default Intune permissions to your managed identity
.\grant-permissions-managed-identity.ps1 -ManagedIdentityDisplayName "YourManagedIdentityName"
# Or grant custom permissions for specific use cases
.\grant-permissions-managed-identity.ps1 -ManagedIdentityDisplayName "YourManagedIdentityName" -CustomPermissions @("User.Read.All", "Group.Read.All")
- Assign the managed identity to your Azure Automation Account
- Import the scripts as runbooks
- Schedule execution as needed
This approach enables:
- β° Scheduled execution (daily, weekly, etc.)
- π€ Unattended operations without user interaction
- π Centralized logging and monitoring
- π Integration with other Azure services
The grant-permissions-managed-identity.ps1
script grants these Microsoft Graph API permissions by default:
Permission | Description |
---|---|
DeviceManagementManagedDevices.ReadWrite.All |
Full device management access |
DeviceManagementConfiguration.ReadWrite.All |
Configuration policy management |
DeviceManagementApps.ReadWrite.All |
Application management |
Device
8000
ManagementServiceConfig.ReadWrite.All |
Service configuration |
DeviceManagementRBAC.ReadWrite.All |
Role-based access control |
DeviceManagementManagedDevices.PrivilegedOperations.All |
Advanced device operations |
These permissions cover most common Intune automation scenarios.
IntuneAutomation/
βββ π§ grant-permissions-managed-identity.ps1 # Setup script for managed identity permissions
βββ π scripts/
β βββ π operational/ # Device operations (restart, wipe, sync)
β βββ π± apps/ # Application management and deployment
β βββ β
compliance/ # Compliance reporting and remediation
β βββ π security/ # Security operations and policies
β βββ π» devices/ # Device management and inventory
β βββ π monitoring/ # Monitoring, reporting, and analytics
βββ π templates/ # Script templates for contributors
βββ π LICENSE
βββ π€ CONTRIBUTING.md
βββ π README.md
- Device Operations: Bulk device actions, automated device cleanup
- Compliance Reporting: Automated compliance dashboards and alerts
- App Management: Silent app deployment and update automation
- Security Monitoring: Threat detection and response automation
π‘ Tip: Each script category includes detailed documentation and usage examples.
- PowerShell 5.1 or later (PowerShell 7+ recommended)
- Microsoft Graph PowerShell modules:
Microsoft.Graph.Authentication
- You have to sign in with an Intune Admin account
- Azure Automation Account
- User Assigned Managed Identity with the following permissions:
DeviceManagementManagedDevices.ReadWrite.All
DeviceManagementConfiguration.ReadWrite.All
DeviceManagementApps.ReadWrite.All
DeviceManagementServiceConfig.ReadWrite.All
DeviceManagementRBAC.ReadWrite.All
DeviceManagementManagedDevices.PrivilegedOperations.All
π‘ Tip: Check
grant-permissions-managed-identity.ps1
for more details and how to grant the permissions
- Your Environment in the Azure Automation Account has to have the following modules installed:
Az.Accounts
Az.Resources
Microsoft.Graph.Applications
Microsoft.Graph.Authentication
- Interactive Authentication (default for local execution)
- Managed Identity (recommended for Azure Automation)
We welcome contributions from the community! Whether you're fixing bugs, improving existing scripts, or adding new automation tools, your contributions help IT professionals worldwide.
- π΄ Fork the repository and clone it locally
- π Use our script template: Copy
templates/script-template.ps1
to get started - π Follow our guidelines: Read CONTRIBUTING.md for detailed instructions
- π§ͺ Test thoroughly: Always test your scripts in a lab environment first
- π Submit a pull request: Use our PR template for faster reviews
See our Contributing Guide for detailed instructions, coding standards, and submission guidelines.
Q: I have an Idea for a new script but I need someone to implement it? A: Open an issue and let me know. I'll be happy to implement it.
Q: Scripts fail with authentication errors A: Ensure you have the required Microsoft Graph permissions and modules installed.
Q: Can I use these scripts with GCC High/DoD tenants? A: Yes, but you may need to modify the Graph API endpoints for government clouds.
Q: Are these scripts suitable for production use? A: Yes, but always test in a lab environment first and follow your organization's change management processes.
- π Check the documentation
- π Report issues on GitHub Issues
- π¬ Join discussions on GitHub Discussions
This project is licensed under the MIT License - see the LICENSE file for details.
Ugur Koc - Microsoft MVP
- π Website: https://ugurkoc.de
- π¦ X: @ugurkocde
- πΌ LinkedIn: Ugur Koc
β If this project helps you, please give it a star! β