<# .SYNOPSIS Entry point agent GeoNetAgent — auto-update (opsional) + kirim laporan. .DESCRIPTION Dipanggil Scheduled Task (SYSTEM) atau manual. Sebelum kirim laporan: cek manifest.json vs VERSION lokal; update silent jika beda. config.json lokal dipertahankan saat auto-update. .EXAMPLE powershell -NoProfile -ExecutionPolicy Bypass -File "$env:ProgramData\GeoNetAgent\UserAgent.ps1" #> [CmdletBinding()] param( [switch]$IncludeSoftware, [switch]$SkipAutoUpdate ) $ErrorActionPreference = 'Stop' $agentRoot = Split-Path -Parent $MyInvocation.MyCommand.Path $configPath = Join-Path $agentRoot 'config.json' $updateScript = Join-Path $agentRoot 'lib\Update-GeoNetAgent.ps1' $sendScript = Join-Path $agentRoot 'Send-GeoNetReport.ps1' if (-not (Test-Path $configPath)) { $shareTemplate = Join-Path $agentRoot 'config.share.json' if (Test-Path $shareTemplate) { Write-Warning 'config.json tidak ada - memakai config.share.json.' $configPath = $shareTemplate } } if (-not $SkipAutoUpdate -and (Test-Path $updateScript)) { . $updateScript $null = Update-GeoNetAgentIfNeeded ` -InstallRoot $agentRoot ` -ConfigPath $configPath ` -ScheduleHours 3 ` -Quiet } if (-not (Test-Path $sendScript)) { throw "Send-GeoNetReport.ps1 tidak ditemukan di: $agentRoot" } if (-not (Test-Path $configPath)) { throw "config.json tidak ditemukan di: $agentRoot" } $params = @{ ConfigPath = $configPath } if ($IncludeSoftware) { $params['IncludeSoftware'] = $true } & $sendScript @params exit $LASTEXITCODE