49 lines
1.7 KiB
PowerShell
49 lines
1.7 KiB
PowerShell
function Log-Msg {
|
|
param([string]$Message)
|
|
Write-Host $Message -ForegroundColor Cyan
|
|
try {
|
|
Invoke-RestMethod -Uri "http://10.0.10.8:8000/log" -Method Post -Body @{msg=$Message} -UseBasicParsing -ErrorAction SilentlyContinue | Out-Null
|
|
} catch {}
|
|
}
|
|
|
|
Log-Msg "=========================================================="
|
|
Log-Msg "SONDA DE DIAGNOSTICO — RELEVAMIENTO DEL SISTEMA"
|
|
Log-Msg "=========================================================="
|
|
|
|
Log-Msg "Hostname: $env:COMPUTERNAME"
|
|
Log-Msg "OS: $((Get-CimInstance Win32_OperatingSystem).Caption)"
|
|
Log-Msg "Arquitectura: $((Get-CimInstance Win32_OperatingSystem).OSArchitecture)"
|
|
|
|
# Red
|
|
$ips = Get-NetIPAddress -AddressFamily IPv4 | Where-Object InterfaceAlias -notmatch 'Loopback'
|
|
foreach ($ip in $ips) {
|
|
Log-Msg "Red [$($ip.InterfaceAlias)]: $($ip.IPAddress)/$($ip.PrefixLength)"
|
|
}
|
|
|
|
# Dominio
|
|
try {
|
|
$domain = (Get-CimInstance Win32_ComputerSystem).Domain
|
|
$inDomain = (Get-CimInstance Win32_ComputerSystem).PartOfDomain
|
|
Log-Msg "Dominio: $domain (Unido: $inDomain)"
|
|
} catch {
|
|
Log-Msg "Dominio: No disponible"
|
|
}
|
|
|
|
# Servicios clave
|
|
$servicios = @('sshd', 'MSSQLSERVER', 'NTDS', 'DNS')
|
|
foreach ($svc in $servicios) {
|
|
$s = Get-Service -Name $svc -ErrorAction SilentlyContinue
|
|
if ($s) {
|
|
Log-Msg "Servicio [$svc]: $($s.Status)"
|
|
}
|
|
}
|
|
|
|
# Firewall SSH
|
|
$rule = Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue
|
|
Log-Msg "Firewall SSH (TCP 22): $(if ($rule) { 'Habilitado' } else { 'No configurado' })"
|
|
|
|
Log-Msg "=========================================================="
|
|
Log-Msg "SONDA COMPLETADA."
|
|
Log-Msg "=========================================================="
|
|
exit
|