Skip to content

This script enables IT administrators to efficiently analyze and audit Intune assignments. It checks assignments for specific users, groups, or devices, displays all policies and their assignments, identifies unassigned policies, detects empty groups in assignments, and searches for specific settings across policies.

License

Notifications You must be signed in to change notification settings

ugurkocde/IntuneAssignmentChecker

Repository files navigation

πŸ” Intune Assignment Checker

IntuneAssignmentChecker_Header

πŸ“‘ Table of Contents

πŸš€ Quick Start

Important: All commands must be run in a PowerShell 7 session. The script will not work in PowerShell 5.1 or earlier versions.

Option 1: Install from PowerShell Gallery (Recommended)

# Install from PowerShell Gallery
Install-PSResource IntuneAssignmentChecker

# Open a new PowerShell 7 session to run the script with
IntuneAssignmentChecker

If you encounter any issues during installation, try reinstalling:

Install-PSResource IntuneAssignmentChecker -Reinstall

To update to the latest version:

Update-PSResource IntuneAssignmentChecker

Option 2: Manual Installation

# Install Microsoft Graph PowerShell SDK
Install-Module Microsoft.Graph.Authentication -Scope CurrentUser

# Download and run the script
.\IntuneAssignmentChecker_v3.ps1

✨ Features

  • πŸ” Check assignments for users, groups, and devices
  • πŸ“± View all 'All User' and 'All Device' assignments
  • πŸ” Support for certificate-based authentication
  • πŸ”„ Built-in auto-update functionality
  • πŸ“Š Detailed reporting of Configuration Profiles, Compliance Policies, and Applications
  • πŸ“ˆ Interactive HTML reports with charts and filterable tables

πŸŽ₯ Demo

πŸ“‹ Prerequisites

Required PowerShell Version

  • PowerShell 7.0 or higher is required

Required PowerShell Modules

  • Microsoft Graph PowerShell SDK
    • Specifically Microsoft.Graph.Authentication

Required Permissions

Your Entra ID application registration needs these permissions:

Permission Type Description
User.Read.All Application Read all users' full profiles
Group.Read.All Application Read all groups
Device.Read.All Application Read all devices
DeviceManagementApps.Read.All Application Read Microsoft Intune apps
DeviceManagementConfiguration.Read.All Application Read Microsoft Intune device configuration and policies
DeviceManagementManagedDevices.Read.All Application Read Microsoft Intune devices

πŸ” Authentication Options

Option 1: Certificate-Based Authentication (Recommended for automation)

Follow these steps if you want to use certificate authentication with an app registration:

  1. Create an Entra ID App Registration:

    • Navigate to Azure Portal > Entra ID > App Registrations
    • Click "New Registration"
    • Name your application (e.g., "IntuneAssignmentChecker")
    • Select "Accounts in this organizational directory only"
    • Click "Register"
  2. Grant required Application permissions:

    • In your app registration, go to "API Permissions"
    • Click "Add a permission" > "Microsoft Graph"
    • Select "Application permissions"
    • Add all required permissions listed in Prerequisites
    • Click "Grant admin consent"
  3. Create and configure certificate authentication:

    # Create self-signed certificate
    New-SelfSignedCertificate `
        -Subject "CN=IntuneAssignmentChecker" `
        -CertStoreLocation "cert:\CurrentUser\My" `
        -NotAfter (Get-Date).AddYears(2) `
        -KeySpec Signature `
        -KeyExportPolicy Exportable
    
    # Export the certificate
    $cert = Get-ChildItem Cert:\CurrentUser\My | Where-Object {$_.Subject -like "*IntuneAssignmentChecker*"}
    Export-Certificate -Cert $cert -FilePath "C:\temp\IntuneAssignmentChecker.cer"
  4. Upload certificate to your app registration:

    • In Azure Portal, go to your app registration
    • Click "Certificates & secrets"
    • Select "Certificates"
    • Click "Upload certificate"
    • Upload the .cer file you exported (C:\temp\IntuneAssignmentChecker.cer)
  5. Configure the script with your app details:

    # Update these values in the script
    $appid = '<YourAppIdHere>'           # Application (Client) ID
    $tenantid = '<YourTenantIdHere>'     # Directory (Tenant) ID
    $certThumbprint = '<YourThumbprint>' # Certificate Thumbprint

Option 2: Interactive Authentication (Simpler setup)

If you prefer not to set up an app registration, you can use interactive authentication:

You can just run the script without any changes. It will ask if you want to use interactive authentication where you will type "y" and press enter.

This will prompt you to sign in with your credentials when running the script. The permissions will be based on your user account's roles and permissions in Entra ID.

Which Option Should I Choose?

  • Choose Certificate Authentication if you:

    • Need to run the script unattended
    • Want to automate the process
    • Need consistent permissions regardless of user
    • Are comfortable with more complex setup
  • Choose Interactive Authentication if you:

    • Want a simpler setup
    • Don't need automation
    • Are comfortable using your user credentials
    • Only need to run the script occasionally

Note: Keep your certificate and app credentials secure! Anyone with access to these can access your Intune environment with the configured permissions.

πŸ“– Usage

The script provides a comprehensive menu-driven interface with the following options:

🎯 Assignment Checks

  1. Check User(s) Assignments

    • View all policies and apps assigned to specific users
    • Supports checking multiple users (comma-separated)
    • Shows direct and group-based assignments
  2. Check Group(s) Assignments

    • View all policies and apps assigned to specific groups
    • Supports checking multiple groups
    • Shows assignment types (Include/Exclude)
  3. Check Device(s) Assignments

    • View all policies and apps assigned to specific devices
    • Supports checking multiple devices
    • Shows inherited assignments from device groups

πŸ“‹ Policy Overview

  1. Show All Policies and Their Assignments

    • Comprehensive view of all Intune policies
    • Grouped by policy type and platform
    • Includes assignment details
  2. Show All 'All Users' Assignments

    • Lists policies assigned to all users
    • Includes apps and configurations
    • Helps identify broad-scope policies
  3. Show All 'All Devices' Assignments

    • Lists policies assigned to all devices
    • Shows platform-specific assignments
    • Identifies universal device policies

βš™οΈ Advanced Options

  1. Generate HTML Report

    • Creates interactive HTML report
    • Includes charts and graphs
    • Filterable tables with search functionality
    • Dark/Light mode toggle
    • Export capabilities to Excel/CSV
  2. Show Policies Without Assignments

    • Identifies unassigned policies
    • Grouped by policy type
    • Helps clean up unused policies
  3. Check for Empty Groups in Assignments

    • Finds assignments to empty groups
    • Helps identify ineffective policies
    • Supports CSV export of findings

πŸ› οΈ System Options

  • Exit (0): Safely disconnect and close
  • Report Bug (99): Opens GitHub issues page

All operations support CSV export for detailed analysis and reporting.

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

About

This script enables IT administrators to efficiently analyze and audit Intune assignments. It checks assignments for specific users, groups, or devices, displays all policies and their assignments, identifies unassigned policies, detects empty groups in assignments, and searches for specific settings across policies.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project