From f2f200f904f4d9bcb7934712836f6e1125adb26a Mon Sep 17 00:00:00 2001 From: Tomas Kracmar Date: Tue, 24 Nov 2026 13:12:11 +0100 Subject: [PATCH] feat(toolkit): number menu entries automatically The menu is now a list of entries in display order; the numbers 1-24 are assigned at startup instead of being hand-picked per item, so adding or moving an entry never needs renumbering. Dispatch keeps stable internal ids. README reference to 'delete tenant auth and app registration' is now item 24. --- CHANGELOG_macOS_IntuneToolkit.md | 6 ++++++ README.md | 2 +- Start-IntuneToolkit.ps1 | 15 +++++++++++++-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/CHANGELOG_macOS_IntuneToolkit.md b/CHANGELOG_macOS_IntuneToolkit.md index 2a08140..732a025 100644 --- a/CHANGELOG_macOS_IntuneToolkit.md +++ b/CHANGELOG_macOS_IntuneToolkit.md @@ -1,5 +1,11 @@ # macOS Intune Toolkit Changelog +## 2026-11-24 — v4.6.1 — Sequential menu numbers + +### Changed +- **`Start-IntuneToolkit.ps1`** + - Menu numbers were whatever each item was given when it was added (1, 2, 23, 7, 5, 6, 3, ...). The menu is now a list of entries in display order and the numbers 1-24 are assigned automatically, so adding or moving an entry never needs renumbering. Dispatch still uses stable internal ids. Numbers for items 3 and up changed; the README reference to "delete tenant auth and app registration" is now item **24**. + ## 2026-11-24 — v4.6.0 — Upstream 3.10/3.11 fixes, faster export, lazy migration, drift, bulk scope tags ### Added diff --git a/README.md b/README.md index ce04198..0984d95 100644 --- a/README.md +++ b/README.md @@ -169,4 +169,4 @@ By default `Initialize-IntuneAuth.ps1` creates an **app-only** registration. Eve * **Audit logs** show the app's display name (e.g., `IntuneManagement-tomas.kracmar@cqre.net`), not the admin's UPN. The initializer now automatically names the app after the **authenticated Entra user** to improve traceability. * **PIM is not enforced** for app-only secrets. The service principal has standing permissions, so write operations can occur outside an elevated PIM window. * If you need strict PIM compliance, use **delegated authentication** (`-AuthMode Browser` or `-AuthMode DeviceCode`) so calls are made in the signed-in user's context. Note that `DeviceCode` may be blocked by Conditional Access policies. -* To fully remove a tenant's local credentials **and** the Entra app registration, use menu item **15** in the TUI or run `./Scripts/Initialize-IntuneAuth.ps1 -TenantId "" -DeleteApp`. +* To fully remove a tenant's local credentials **and** the Entra app registration, use menu item **24** ("Delete tenant auth and app registration") in the TUI or run `./Scripts/Initialize-IntuneAuth.ps1 -TenantId "" -DeleteApp`. diff --git a/Start-IntuneToolkit.ps1 b/Start-IntuneToolkit.ps1 index 9f12456..0b9ab06 100644 --- a/Start-IntuneToolkit.ps1 +++ b/Start-IntuneToolkit.ps1 @@ -326,7 +326,9 @@ $commonParams = @{ SettingsFile = $SettingsFile } -$menuItems = @( +# Menu entries in display order. Id is the internal dispatch id used below; the number shown to the user +# is assigned automatically, so entries can be added or moved without renumbering anything. +$menuDefs = @( # Export / Import "1. Export policies" "2. Import policies" @@ -358,6 +360,14 @@ $menuItems = @( "15. Delete tenant auth and app registration" "0. Exit" ) +$menuIdByNumber = @{} +$menuItems = @() +for($i = 0; $i -lt $menuDefs.Count; $i++) +{ + $menuIdByNumber[$i + 1] = $menuDefs[$i].Id + $menuItems += ("{0}." -f ($i + 1)).PadRight(4) + $menuDefs[$i].Label +} +$menuItems += "0.".PadRight(4) + "Exit" while($true) { @@ -386,7 +396,8 @@ while($true) exit 0 } - $choiceNumber = [int]($selection -replace "^(\d+)\..*$", '$1') + $choiceNumber = $menuIdByNumber[[int]($selection -replace "^(\d+)\..*$", '$1')] + if($null -eq $choiceNumber) { continue } $script = $null switch($choiceNumber)