diff --git a/CHANGELOG_macOS_IntuneToolkit.md b/CHANGELOG_macOS_IntuneToolkit.md index e6a2014..60db8fa 100644 --- a/CHANGELOG_macOS_IntuneToolkit.md +++ b/CHANGELOG_macOS_IntuneToolkit.md @@ -1,5 +1,11 @@ # macOS Intune Toolkit Changelog +## 2026-11-24 — v4.5.1 — Full tenant export menu entry + +### Added +- **`Start-IntuneToolkit.ps1`** + - New menu item **23. Full tenant export (all types + assignments, dated folder)**. Asks for an export root folder (remembered in `Settings.json` as `FullExportRoot`, default `~/Local/IntuneExports`), then exports every default object type with assignments for the current tenant into `/-yymmdd` (adds `-HHmm` if that folder already exists). Pair with item 22 to see drift between two exports of the same tenant. + ## 2026-11-24 — v4.5.0 — Offline tenant comparison ### Added diff --git a/Start-IntuneToolkit.ps1 b/Start-IntuneToolkit.ps1 index 59a7a1a..767389c 100644 --- a/Start-IntuneToolkit.ps1 +++ b/Start-IntuneToolkit.ps1 @@ -174,6 +174,25 @@ function Update-TenantNameCache catch { } } +function Get-LauncherSetting +{ + param([string]$SettingsPath, [string]$Name) + if(-not (Test-Path $SettingsPath)) { return $null } + try { (Get-Content $SettingsPath -Raw -ErrorAction Stop | ConvertFrom-Json -AsHashtable -ErrorAction Stop)[$Name] } catch { $null } +} + +function Set-LauncherSetting +{ + param([string]$SettingsPath, [string]$Name, $Value) + try + { + $raw = if(Test-Path $SettingsPath) { Get-Content $SettingsPath -Raw -ErrorAction Stop | ConvertFrom-Json -AsHashtable -ErrorAction Stop } else { @{} } + $raw[$Name] = $Value + $raw | ConvertTo-Json -Depth 10 | Set-Content -Path $SettingsPath -Force + } + catch { } +} + function Resolve-TenantName { param([string]$TenantId, [string]$SettingsPath) @@ -311,6 +330,7 @@ $menuItems = @( # Export / Import "1. Export policies" "2. Import policies" + "23. Full tenant export (all types + assignments, dated folder)" "7. Export assignments to CSV/Markdown" "5. Backup assignments" "6. Restore assignments" @@ -491,6 +511,38 @@ while($true) continue } + if($choiceNumber -eq 23) + { + $defaultRoot = Get-LauncherSetting -SettingsPath $settingsPath -Name "FullExportRoot" + if([string]::IsNullOrWhiteSpace($defaultRoot)) { $defaultRoot = Join-Path $HOME "Local/IntuneExports" } + $root = Read-Host "Export root folder (Enter = $defaultRoot)" + if([string]::IsNullOrWhiteSpace($root)) { $root = $defaultRoot } + $root = [IO.Path]::GetFullPath(($root.Trim().Trim('"',"'") -replace '^~', $HOME)) + Set-LauncherSetting -SettingsPath $settingsPath -Name "FullExportRoot" -Value $root + + $tenantLabel = if($currentTenant -and $currentTenant.TenantName) { $currentTenant.TenantName } else { $TenantId } + $safeName = ($tenantLabel -replace '[\\/:*?"<>|\s]+', '-').Trim('-') + $exportPath = Join-Path $root "$safeName-$(Get-Date -Format 'yyMMdd')" + if(Test-Path -LiteralPath $exportPath) { $exportPath = "$exportPath-$(Get-Date -Format 'HHmm')" } + + Write-Host "`n Tenant : $tenantLabel ($TenantId)" -ForegroundColor Green + Write-Host " Export path : $exportPath" + Write-Host " Content : all object types, with assignments" + if((Read-Host "`nProceed? [Y/n]") -like 'n*') { continue } + + $exportParams = @{ Action = "Export"; TenantId = $TenantId; ExportPath = $exportPath; IncludeAssignments = $true; AuthMode = $AuthMode } + if($AppId) { $exportParams.AppId = $AppId } + if($Secret) { $exportParams.Secret = $Secret } + elseif($Certificate) { $exportParams.Certificate = $Certificate } + if($SettingsFile) { $exportParams.SettingsFile = $SettingsFile } + & (Join-Path $projectRoot "Scripts/Start-HeadlessIntune.ps1") @exportParams + Write-Host "`nExport finished: $exportPath" -ForegroundColor Cyan + Write-Host "Tip: compare with an earlier export of this tenant using menu item 22 (leave the prefix blank to see drift)." -ForegroundColor DarkGray + Write-Host "`nPress any key to return to the menu..." -ForegroundColor DarkGray + $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") + continue + } + if($choiceNumber -eq 22) { # Offline comparison of two export folders; no tenant connection needed