Read NinjaOne rollout variables from environment
This commit is contained in:
@@ -18,6 +18,20 @@ $clientConfigPath = Join-Path $installRoot "config\ocsentinel-client.json"
|
|||||||
$secretScriptPath = Join-Path $installRoot "scripts\protect-ocsentinel-secret.ps1"
|
$secretScriptPath = Join-Path $installRoot "scripts\protect-ocsentinel-secret.ps1"
|
||||||
$secretPath = "C:\ProgramData\OCSentinel\secrets\ocsentinel-upload-secret.dat"
|
$secretPath = "C:\ProgramData\OCSentinel\secrets\ocsentinel-upload-secret.dat"
|
||||||
|
|
||||||
|
# NinjaOne script variables are exposed as process environment variables.
|
||||||
|
if ([string]::IsNullOrWhiteSpace($WebhookUrl)) {
|
||||||
|
$WebhookUrl = $env:WebhookUrl
|
||||||
|
}
|
||||||
|
|
||||||
|
if ([string]::IsNullOrWhiteSpace($SecretValue)) {
|
||||||
|
$SecretValue = $env:SecretValue
|
||||||
|
}
|
||||||
|
|
||||||
|
$runInitialScan = $RunInitialStatusScan.IsPresent
|
||||||
|
if (-not $runInitialScan -and -not [string]::IsNullOrWhiteSpace($env:RunInitialStatusScan)) {
|
||||||
|
$runInitialScan = $env:RunInitialStatusScan -match '^(1|true|yes|on)$'
|
||||||
|
}
|
||||||
|
|
||||||
function Assert-ArtifactSignature {
|
function Assert-ArtifactSignature {
|
||||||
param([Parameter(Mandatory)][string]$ExecutablePath)
|
param([Parameter(Mandatory)][string]$ExecutablePath)
|
||||||
|
|
||||||
@@ -108,7 +122,7 @@ if (-not [string]::IsNullOrWhiteSpace($SecretValue)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($RunInitialStatusScan) {
|
if ($runInitialScan) {
|
||||||
if (-not (Test-Path -LiteralPath $monitorPath)) {
|
if (-not (Test-Path -LiteralPath $monitorPath)) {
|
||||||
throw "OCSentinel was installed, but the monitor script is missing."
|
throw "OCSentinel was installed, but the monitor script is missing."
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user