Add local Windows Server inventory collection and validation; include core package

This commit is contained in:
2026-10-30 11:24:40 -07:00
parent 967b2bd46a
commit f65ade9fff
35 changed files with 2200 additions and 56 deletions

View File

@@ -0,0 +1,16 @@
function Get-SamsaraNetwork {
param($Result)
$processes = @{}
Invoke-SamsaraRead $Result 'Process names' {
Get-Process -ErrorAction Stop | ForEach-Object { $processes[[int]$_.Id] = [string]$_.ProcessName }
}
Invoke-SamsaraRead $Result 'TCP connections' {
$Result.data = @(Get-NetTCPConnection -ErrorAction Stop | ForEach-Object {
$processName = if ($processes.ContainsKey([int]$_.OwningProcess)) { $processes[[int]$_.OwningProcess] } else { 'Unavailable or process exited' }
[pscustomobject]@{ state = [string]$_.State; local_address = [string]$_.LocalAddress; local_port = [int]$_.LocalPort
remote_address = [string]$_.RemoteAddress; remote_port = [int]$_.RemotePort
pid = [int]$_.OwningProcess; process = $processName; direction = 'Unknown' }
})
}
$Result.limitations += 'Point-in-time TCP only. Connection direction, historical activity, UDP and other network compartments are unverified. Process names may race process exit or be hidden.'
}