Skip to content

Instantly share code, notes, and snippets.

View sandytsang's full-sized avatar

Sandy Zeng [MVP] sandytsang

View GitHub Profile
@sandytsang
sandytsang / Invoke-ChangeDefaultLanguage.ps1
Last active March 26, 2025 08:37
For install additional language and change language regional settings for Windows 11
#Original script from https://www.inthecloud247.com/install-an-additional-language-pack-on-windows-11-during-autopilot-enrollment/
#This script need to run as System Context and as 64bit PowerShell
<#
.SYNOPSIS
Script to install langauge pack and change MUI langauge
.DESCRIPTION
Script to install langauge package and set default language
@sandytsang
sandytsang / Custom-IntuneReportingReadRole.json
Created October 23, 2021 18:49
Create custom role for Intune Reporting
{
"Name": "(Custom) - Intune Reporting Reader",
"Id": "",
"IsCustom": true,
"Description": "This is a custom role for Intune Reporting, allowing only read access to log and run workbooks",
"actions": [
"Microsoft.OperationalInsights/workspaces/query/IntuneAuditLogs/read",
"Microsoft.OperationalInsights/workspaces/query/IntuneDeviceComplianceOrg/read",
"Microsoft.OperationalInsights/workspaces/query/IntuneDevices/read",
"Microsoft.OperationalInsights/workspaces/query/IntuneOperationalLogs/read",
$scope = "https://graph.microsoft.com/.default"
$Tenants = @("tenant1.onmicrosoft.com", "tenant2.onmicrosoft.com", "tenant3.onmicrosoft.com") #List here your tenants
$AppID = "10f9be91-4c9b-4427-aa71-143d18abafb5" #Change this to your own app ID
$AppSecret = "vJctTjssIeidhuzNQDkfWUIF/Pe+ae+adfafafafaf" #Change this to your own App Secret
#Get device serial number
#$Serial = (Get-WmiObject -Class Win32_BIOS).SerialNumber
#Device Serial number, change this!
$Serial = "PC03SVKGXXX"
#Set executionPolicy
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force
#Install or update Microsoft Graph Intune module
try {
Write-Verbose -Message "Attempting to locate Microsoft.Graph.Intune module on local system"
$GraphModule = Get-Module -Name "Microsoft.Graph.Intune" -ListAvailable -ErrorAction Stop -Verbose:$false
if ($GraphModule -ne $null) {
Write-Verbose -Message "Microsoft.Graph.Intune module detected, checking for latest version"
$LatestModuleVersion = (Find-Module -Name Microsoft.Graph.Intune -ErrorAction Stop -Verbose:$false).Version
# Check if the Azure AD PowerShell module has already been loaded.
if ( ! ( Get-Module AzureAD ) ) {
# Check if the Azure AD PowerShell module is installed.
if ( Get-Module -ListAvailable -Name AzureAD ) {
# The Azure AD PowerShell module is not load and it is installed. This module must be loaded for other operations performed by this script.
Write-Host -ForegroundColor Green "Loading the Azure AD PowerShell module..."
Import-Module AzureAD
} else {
Install-Module AzureAD
}