Strip legacy UI and keep headless runtime
This commit is contained in:
85
Runtime/IntuneManagement.Runtime.psm1
Normal file
85
Runtime/IntuneManagement.Runtime.psm1
Normal file
@@ -0,0 +1,85 @@
|
||||
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,
|
||||
[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: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 <Tenant-guid>."
|
||||
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 <AppId>."
|
||||
}
|
||||
|
||||
if($global:ClientSecret)
|
||||
{
|
||||
Write-Host "Using Azure App Secret"
|
||||
}
|
||||
elseif($global:ClientCert)
|
||||
{
|
||||
Write-Host "Using Azure App Certificate"
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Warning "Azure App Secret or Certificate is missing. Use -Secret <Secret> or -Certificate <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
|
||||
Reference in New Issue
Block a user