75 lines
1.5 KiB
PowerShell
75 lines
1.5 KiB
PowerShell
[CmdletBinding()]
|
|
param(
|
|
[Parameter(Mandatory = $true)]
|
|
[ValidateSet("Export","Import")]
|
|
[string]$Action,
|
|
|
|
[Parameter(Mandatory = $true)]
|
|
[string]$TenantId,
|
|
|
|
[Parameter(Mandatory = $true)]
|
|
[string]$AppId,
|
|
|
|
[string]$Secret,
|
|
|
|
[string]$Certificate,
|
|
|
|
[string]$SettingsFile,
|
|
|
|
[string]$BatchFile,
|
|
|
|
[string]$NameFilter = "",
|
|
|
|
[string[]]$ObjectTypes,
|
|
|
|
[string]$ExportPath,
|
|
|
|
[string]$ImportPath,
|
|
|
|
[ValidateSet("alwaysImport","skipIfExist","replace","replace_with_assignments","update")]
|
|
[string]$ImportType = "alwaysImport",
|
|
|
|
[switch]$IncludeAssignments,
|
|
|
|
[switch]$AddCompanyName,
|
|
|
|
[switch]$IncludeScopeTags,
|
|
|
|
[switch]$ReplaceDependencyIds
|
|
)
|
|
|
|
$modulePath = Join-Path $PSScriptRoot "Headless/IntuneManagement.Headless.psd1"
|
|
Import-Module $modulePath -Force
|
|
|
|
$invokeParams = @{
|
|
Action = $Action
|
|
TenantId = $TenantId
|
|
AppId = $AppId
|
|
SettingsFile = $SettingsFile
|
|
BatchFile = $BatchFile
|
|
NameFilter = $NameFilter
|
|
ExportPath = $ExportPath
|
|
ImportPath = $ImportPath
|
|
ImportType = $ImportType
|
|
IncludeAssignments = $IncludeAssignments
|
|
AddCompanyName = $AddCompanyName
|
|
IncludeScopeTags = $IncludeScopeTags
|
|
ReplaceDependencyIds = $ReplaceDependencyIds
|
|
}
|
|
|
|
if($PSBoundParameters.ContainsKey("ObjectTypes"))
|
|
{
|
|
$invokeParams.ObjectTypes = $ObjectTypes
|
|
}
|
|
|
|
if($Secret)
|
|
{
|
|
$invokeParams.Secret = $Secret
|
|
}
|
|
elseif($Certificate)
|
|
{
|
|
$invokeParams.Certificate = $Certificate
|
|
}
|
|
|
|
Invoke-IntunePolicyAction @invokeParams
|