function Test-IsWindowsPlatform { [Environment]::OSVersion.Platform -eq [System.PlatformID]::Win32NT } function Initialize-IntuneManagementRuntime { [CmdletBinding()] param( [string]$View = "", [switch]$ShowConsoleWindow, [switch]$JSonSettings, [string]$JSonFile, [switch]$Silent, [string]$SilentBatchFile, [string]$TenantId, [string]$AppId, [string]$Secret, [string]$Certificate, [ValidateSet("AppOnly","Browser")] [string]$AuthMode = "AppOnly", [string]$RedirectUri, [string]$GraphEnvironment, [string]$GCCType ) $PSModuleAutoloadingPreference = "none" [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 $global:hideUI = $true $global:SilentBatchFile = $SilentBatchFile $global:TenantId = $TenantId $global:AzureAppId = $AppId $global:ClientSecret = $Secret $global:ClientCert = $Certificate $global:HeadlessAuthMode = $AuthMode $global:MSALRedirectUri = $RedirectUri $global:UseGraphEnvironment = $GraphEnvironment $global:UseGCCType = $GCCType $global:UseJSonSettings = ($JSonSettings -eq $true) $global:JSonSettingFile = $JSonFile if(-not $Silent) { Write-Warning "UI support has been removed. Continuing in headless mode." } if(-not $global:TenantId) { Write-Error "Tenant Id is missing. Use -TenantId ." return } if($global:TenantId) { Write-Host "Using Tenant Id: $($global:TenantId)" } if($global:AzureAppId) { Write-Host "Using Azure App Id: $($global:AzureAppId)" } else { Write-Warning "Azure App Id is missing. Use -AppId ." } if($global:ClientSecret) { Write-Host "Using Azure App Secret" } elseif($global:ClientCert) { Write-Host "Using Azure App Certificate" } elseif($global:HeadlessAuthMode -eq "Browser") { Write-Host "Using browser authentication" } else { Write-Warning "Azure App Secret or Certificate is missing. Use -Secret or -Certificate ." } if($global:UseJSonSettings) { Write-Host "Use json settings" } Import-Module (Join-Path (Split-Path -Parent $PSScriptRoot) "Core.psm1") -Force -Global Start-CoreApp $View } Export-ModuleMember -Function Initialize-IntuneManagementRuntime, Test-IsWindowsPlatform