diff --git a/GeoNetAgent/agent/Collect-GeoNetReport.ps1 b/GeoNetAgent/agent/Collect-GeoNetReport.ps1 index a38b164..cffef1f 100644 --- a/GeoNetAgent/agent/Collect-GeoNetReport.ps1 +++ b/GeoNetAgent/agent/Collect-GeoNetReport.ps1 @@ -10,12 +10,12 @@ param( ) $ErrorActionPreference = 'Stop' -$AgentVersion = '0.1.10-phase0' $SchemaVersion = '1.0' $scriptRoot = Split-Path -Parent $MyInvocation.MyCommand.Path $libPath = Join-Path $scriptRoot 'lib' +. (Join-Path $libPath 'Agent-InstallCore.ps1') . (Join-Path $libPath 'Format-IsoDateTime.ps1') . (Join-Path $libPath 'Format-Text.ps1') . (Join-Path $libPath 'Get-SystemInfo.ps1') @@ -31,6 +31,11 @@ $libPath = Join-Path $scriptRoot 'lib' . (Join-Path $libPath 'Get-SoftwareInfo.ps1') . (Join-Path $libPath 'Build-GeoNetReportPayload.ps1') +$AgentVersion = Get-GeoNetLocalAgentVersion -InstallRoot $scriptRoot +if ([string]::IsNullOrWhiteSpace($AgentVersion)) { + $AgentVersion = 'unknown' +} + if (-not $OutputDir) { $repoRoot = Split-Path -Parent $scriptRoot $OutputDir = Join-Path $repoRoot 'samples\agent-reports' diff --git a/GeoNetAgent/agent/README.md b/GeoNetAgent/agent/README.md index 67c1280..67c70bd 100644 --- a/GeoNetAgent/agent/README.md +++ b/GeoNetAgent/agent/README.md @@ -63,6 +63,7 @@ bash infra/collector/publish_agent_install.sh | Versi | Highlight | |-------|-----------| +| v0.1.15 | GPU VRAM akurat >4GB (`nvidia-smi`, registry `qwMemorySize`) | | v0.1.10 | `cpu{}` detail (cores, clock, cache, arch); `system.cpu_model` tetap | | v0.1.9 | `physical_disks[]`, DDR label, GPU driver/resolusi, `form_factor` Laptop/PC | | v0.1.8 | `gpus[]`, disk model, auto-update, interval task 3 jam | diff --git a/GeoNetAgent/agent/Send-GeoNetReport.ps1 b/GeoNetAgent/agent/Send-GeoNetReport.ps1 index 90c6e83..02c5ced 100644 --- a/GeoNetAgent/agent/Send-GeoNetReport.ps1 +++ b/GeoNetAgent/agent/Send-GeoNetReport.ps1 @@ -28,6 +28,7 @@ $libPath = Join-Path $scriptRoot 'lib' . (Join-Path $libPath 'Get-HealthInfo.ps1') . (Join-Path $libPath 'Get-PeripheralsInfo.ps1') . (Join-Path $libPath 'Get-SoftwareInfo.ps1') +. (Join-Path $libPath 'Agent-InstallCore.ps1') . (Join-Path $libPath 'Build-GeoNetReportPayload.ps1') . (Join-Path $libPath 'Send-CollectorReport.ps1') @@ -53,7 +54,10 @@ if (-not $CollectorUrl -or -not $AgentToken) { throw "CollectorUrl dan AgentToken wajib (parameter atau config.json)." } -$AgentVersion = '0.1.10-phase0' +$AgentVersion = Get-GeoNetLocalAgentVersion -InstallRoot $scriptRoot +if ([string]::IsNullOrWhiteSpace($AgentVersion)) { + $AgentVersion = 'unknown' +} $SchemaVersion = '1.0' $payload = Build-GeoNetReportPayload ` @@ -65,12 +69,4 @@ $payload = Build-GeoNetReportPayload ` Write-Host "Mengirim laporan ke $CollectorUrl ..." -ForegroundColor Cyan $result = Send-GeoNetCollectorReport -Payload $payload -CollectorUrl $CollectorUrl -AgentToken $AgentToken - -if ($result.Success) { - Write-Host "OK: $($result.Response | ConvertTo-Json -Compress)" -ForegroundColor Green - exit 0 -} - -Write-Host "GAGAL: $($result.Error)" -ForegroundColor Red -if ($result.Body) { Write-Host $result.Body -ForegroundColor Yellow } -exit 2 +Write-GeoNetReportOutcome -Result $result diff --git a/GeoNetAgent/agent/VERSION b/GeoNetAgent/agent/VERSION index 4ca719c..8a4acd9 100644 --- a/GeoNetAgent/agent/VERSION +++ b/GeoNetAgent/agent/VERSION @@ -1 +1 @@ -0.1.12-phase0 +0.1.15-phase0 diff --git a/GeoNetAgent/agent/install/index.html b/GeoNetAgent/agent/install/index.html index 13c8168..fef42b2 100644 --- a/GeoNetAgent/agent/install/index.html +++ b/GeoNetAgent/agent/install/index.html @@ -37,6 +37,12 @@ Tanpa Admin, Scheduled Task tidak terdaftar. +
Restricted — perintah
+ & "...\GeoNetAgent-Install.ps1" akan gagal. Selalu pakai baris 2a dengan
+ -ExecutionPolicy Bypass (sudah disertakan di bawah).
+ Jalankan satu per satu — baris 1 dulu, tunggu selesai, lalu baris 2.
@@ -44,26 +50,28 @@Invoke-WebRequest -Uri 'https://agent.gisportal.id/install/GeoNetAgent-Install.ps1' -OutFile "$env:TEMP\GeoNetAgent-Install.ps1" -UseBasicParsing
Baris 2a Install + kirim laporan pertama:
-& "$env:TEMP\GeoNetAgent-Install.ps1"- -
Baris 2a Install + kirim laporan pertama (Optional jika error):
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "$env:TEMP\GeoNetAgent-Install.ps1"+
Baris 2a Alternatif (jika ExecutionPolicy sudah RemoteSigned / Bypass):
& "$env:TEMP\GeoNetAgent-Install.ps1"+
Baris 2b Atau hanya pasang/update file + task (tanpa laporan sekarang):
-& "$env:TEMP\GeoNetAgent-Install.ps1" -SkipInitialRun+
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "$env:TEMP\GeoNetAgent-Install.ps1" -SkipInitialRun
Perintah yang sama dipakai untuk update agent. config.json lokal dipertahankan.
Scheduled Task OK: GeoNetAgent-Report, GeoNetAgent-Report-Startup, GeoNetAgent-Report-Shutdown
+ OK: {"status":"accepted",...}
schtasks /Query /TN GeoNetAgent-Report schtasks /Query /TN GeoNetAgent-Report-Startup -& "$env:ProgramData\GeoNetAgent\UserAgent.ps1"-
Baris terakhir mengirim laporan manual ke collector (opsional).
+Get-Content "$env:ProgramData\GeoNetAgent\VERSION" +powershell.exe -NoProfile -ExecutionPolicy Bypass -File "$env:ProgramData\GeoNetAgent\UserAgent.ps1" +Baris VERSION harus sama dengan badge versi di atas. Baris terakhir mengirim laporan manual ke collector (opsional).
$env:TEMP bisa ter-expand salah. Copy perintah di atas langsung ke prompt Admin.
+ -ExecutionPolicy Bypass, jangan & ...ps1 langsung.VERSION lokal = versi di halaman ini, lalu kirim ulang dengan UserAgent.ps1 (perintah di atas).%TEMP%cd $env:TEMP.\GeoNetAgent-Install.ps1 -SkipInitialRunpowershell.exe -NoProfile -ExecutionPolicy Bypass -File .\GeoNetAgent-Install.ps1 -SkipInitialRun