Update to Microsoft Intune PowerShell example script repository on GitHub
Published Jun 08 2023 09:00 AM 39.7K Views

Since publishing the Intune GitHub sample script repository (repo) containing PowerShell scripts that demonstrate the use of the Microsoft Graph API for automation in 2016, there have been significant changes to the Microsoft Graph and PowerShell modules. To ensure the scripts remain relevant and useful for the community, we have reviewed and updated a subset of the scripts and simplified code. In addition, new GitHub repos have been created to house the updated scripts based on the scenario type.


Important: From a support perspective, Microsoft fully supports Intune and its ability to deploy PowerShell scripts. However, Microsoft does not support the scripts themselves, even if they are on our GitHub repository. They’re provided for example only. You are responsible for anything that they may do within your environment. Always test!


Starting today, the original Intune Graph Samples repo is being archived, however it’ll remain available for educational purposes and may continue to be used to provide examples on how to interact with Microsoft Graph endpoints directly.


Note: The samples in the now archived Intune Graph Samples repo use Azure Active Directory Authentication Library (ADAL) for authentication and authorization functionality, which is supported through June 2023. If you’re still using any of these samples in your environment, please see Migrate to the Microsoft Authentication Library (MSAL) and update them as soon as possible. Differences between ADAL and MSAL may be found here: Differences between ADAL.NET and MSAL.NET apps.


The new sample script repositories

The goal of the new repositories is to provide PowerShell scripts that can be used to automate common tasks in Intune using the Microsoft Graph and Microsoft Graph PowerShell modules. These scripts are intended to help Intune administrators better understand how to utilize the Graph and PowerShell modules for automation. However, it’s up to each organization to use these scripts as a starting point to develop their own automation scripts that they will own and maintain.


Note: With the theme of simplification, the samples do not have code for authentication, which means the newly updated scripts repo will need to be edited and modified before they can be run. Each sample script includes the necessary comments that will guide you through the process of adding the code for authentication. To learn more, see Using Microsoft Graph PowerShell authentication commands.


The new Intune GitHub repos are structured for quick access based on scenario as follows:

  • Microsoft Graph PowerShell SDK Intune Samples – NEW!
    • Updated Intune management scripts with modern PowerShell functions.

  • Sample Shell solutions for Linux and macOS – unchanged
    • Shell script samples compatible with Linux and macOS.

  • Sample Intune solutions – NEW! 
    • Automation scripts to perform actions related to a specific task or scenario.


  • Intune sample scripts – archive
    • Legacy Intune script samples.


We’ve also published a landing page to help locate each GitHub repo created and managed by our team located at: https://aka.ms/IntuneScripts.


Additional script samples will continue to be updated and added in the future, however if you have any suggestions for changes, updates, or ideas for new samples, please feel free to share them in the comments below or reach out to us on Twitter @IntuneSuppTeam. This project is for the Intune community and we want to ensure that it meets the needs and expectations of everyone. Thank you for your contribution and support.

Version history
Last update:
‎Jun 08 2023 09:09 AM
Updated by: