sync: auto-sync from ACG-TECH03L at 2026-04-17 14:25:31
Author: Howard Enos Machine: ACG-TECH03L Timestamp: 2026-04-17 14:25:31
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
# never rename without bumping Schema Version.
|
||||
# ============================================================
|
||||
|
||||
$ScriptVersion = "2.0.1"
|
||||
$ScriptVersion = "2.0.2"
|
||||
$ScriptSchemaVersion = "2.0"
|
||||
$ScriptBuildDate = "2026-04-17"
|
||||
|
||||
@@ -1969,11 +1969,12 @@ try {
|
||||
$net.EstablishedOutbound = $established
|
||||
} catch { $net.EstablishedOutboundError = $_.Exception.Message; $net.EstablishedOutbound = @() }
|
||||
|
||||
# HOSTS file
|
||||
# HOSTS file (read via .NET to avoid PSObject metadata baggage in Get-Content output;
|
||||
# Get-Content lines carry PSDrive/Provider reflection refs that ConvertTo-Json explodes into 40+ MB)
|
||||
try {
|
||||
$hostsPath = "$env:windir\System32\drivers\etc\hosts"
|
||||
$hostsContent = Get-Content $hostsPath -ErrorAction SilentlyContinue
|
||||
$hostsActive = @($hostsContent | Where-Object { $_ -and ($_ -notmatch '^\s*#') -and ($_.Trim() -ne '') })
|
||||
$hostsLines = if (Test-Path $hostsPath) { [System.IO.File]::ReadAllLines($hostsPath) } else { @() }
|
||||
$hostsActive = @($hostsLines | Where-Object { $_ -and ($_ -notmatch '^\s*#') -and ($_.Trim() -ne '') } | ForEach-Object { [string]$_ })
|
||||
$net.HostsFile = [ordered]@{
|
||||
ActiveEntryCount = $hostsActive.Count
|
||||
ActiveEntries = $hostsActive
|
||||
|
||||
Reference in New Issue
Block a user