<# .SYNOPSIS Sonda de Relevamiento para Nodos Windows (Compatible con Agente srv-NS8) .DESCRIPTION Recopila información de hardware, red y software para generar un perfil JSON compatible. .USAGE .\sonda_windows.ps1 #> $ErrorActionPreference = "SilentlyContinue" # --- 1. System Info --- $os = Get-CimInstance Win32_OperatingSystem $cs = Get-CimInstance Win32_ComputerSystem $cpu = Get-CimInstance Win32_Processor $mem = Get-CimInstance Win32_PhysicalMemory | Measure-Object -Property Capacity -Sum # --- 2. Network --- $net = Get-NetIPAddress | Where-Object { $_.AddressFamily -eq 'IPv4' -and $_.InterfaceAlias -notlike '*Loopback*' } | Select-Object IPAddress, InterfaceAlias # --- 3. Disks --- $disks = Get-PhysicalDisk | Select-Object FriendlyName, MediaType, Size # --- 4. Software (Specific Checks) --- $anydesk = Get-Process -Name "AnyDesk" -ErrorAction SilentlyContinue $tailscale = Get-Service -Name "Tailscale" -ErrorAction SilentlyContinue # --- Construct JSON --- $payload = @{ timestamp = (Get-Date).ToString("yyyy-MM-dd HH:mm:ss zzz") connector = @{ hostname_detected = $env:COMPUTERNAME user = $env:USERNAME platorm = "Windows" } cpu = @{ model = $cpu.Name cores = $cpu.NumberOfCores arch = $os.OSArchitecture } ram = @{ total_gb = [math]::Round($mem.Sum / 1GB, 2) raw = $mem.Sum } os = @{ edition = $os.Caption version = $os.Version build = $os.BuildNumber } network = $net disks = $disks services = @{ anydesk_running = [bool]$anydesk tailscale_status = if ($tailscale) { $tailscale.Status } else { "Not Installed" } } } # --- Output --- Write-Host "---START_PAYLOAD---" -ForegroundColor Cyan $payload | ConvertTo-Json -Depth 3 Write-Host "---END_PAYLOAD---" -ForegroundColor Cyan