Headless export now fetches objects 20 per $batch call (was one call per object because UseBatchAPI defaulted to off). -NoBatchApi on Export-Policies.ps1 / Start-HeadlessIntune.ps1 falls back to single calls. Adds per-run setting overrides ($global:SettingOverrides, consulted by Get-SettingValue, set by Invoke-IntuneHeadlessBatch and never persisted). Verify on a tenant by exporting with and without -NoBatchApi and comparing the two folders with Compare-Tenants.py.
48 lines
980 B
PowerShell
48 lines
980 B
PowerShell
<#
|
|
.SYNOPSIS
|
|
Headless Intune policy export wrapper for macOS/Linux/Windows.
|
|
#>
|
|
[CmdletBinding()]
|
|
param(
|
|
[Parameter(Mandatory = $true)]
|
|
[string]$TenantId,
|
|
|
|
[string]$AppId,
|
|
|
|
[string]$Secret,
|
|
|
|
[string]$Certificate,
|
|
|
|
[ValidateSet("AppOnly","Browser","DeviceCode")]
|
|
[string]$AuthMode = "AppOnly",
|
|
|
|
[string]$RedirectUri,
|
|
|
|
[Parameter(Mandatory = $true)]
|
|
[string]$ExportPath,
|
|
|
|
[string]$SettingsFile,
|
|
|
|
[string]$BatchFile,
|
|
|
|
[string]$NameFilter = "",
|
|
|
|
[string]$NameSearchPattern = "",
|
|
|
|
[string]$NameReplacePattern = "",
|
|
|
|
[string[]]$ObjectTypes = (Get-DefaultIntunePolicyObjectTypes),
|
|
|
|
[switch]$IncludeAssignments,
|
|
|
|
[switch]$AddCompanyName,
|
|
|
|
# Batch API is on by default; this falls back to one Graph call per object
|
|
[switch]$NoBatchApi
|
|
)
|
|
|
|
$modulePath = Join-Path (Split-Path -Parent $PSScriptRoot) "Headless/IntuneManagement.Headless.psd1"
|
|
Import-Module $modulePath -Force
|
|
|
|
Export-IntunePolicies @PSBoundParameters
|