[CmdletBinding()] param( [string]$Csv ) $ErrorActionPreference = 'Stop' $winhttp = (& netsh.exe winhttp show proxy 2>&1 | Out-String).Trim() $key = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings' $props = Get-ItemProperty -LiteralPath $key -ErrorAction SilentlyContinue function Get-InternetSetting { param([string]$Name) if ($null -eq $props) { return $null } $property = $props.PSObject.Properties[$Name] if ($null -eq $property) { return $null } return $property.Value } $row = [pscustomobject]@{ ProxyEnable = Get-InternetSetting -Name 'ProxyEnable' ProxyServer = Get-InternetSetting -Name 'ProxyServer' ProxyOverride = Get-InternetSetting -Name 'ProxyOverride' AutoConfigURL = Get-InternetSetting -Name 'AutoConfigURL' AutoDetect = Get-InternetSetting -Name 'AutoDetect' } Write-Host 'WinINET (текущий пользователь):' $row | Format-List Write-Host 'WinHTTP (система):' Write-Host $winhttp if ($Csv) { $parent = Split-Path -Parent $Csv if ($parent -and -not (Test-Path -LiteralPath $parent)) { New-Item -ItemType Directory -Path $parent | Out-Null } $row | Export-Csv -LiteralPath $Csv -NoTypeInformation -Encoding UTF8 Write-Host "Отчёт сохранён: $Csv" } Write-Host 'Настройки не изменялись.'