PowerShell | Windows Registry, Query Proxy Settings
Windows PowerShell Script Verify Proxy Settings
Windows proxy settings allow users to configure their computer to connect to the internet through a proxy server. This intermediary server acts as a gateway between the user's device and the internet, enhancing security, managing network traffic, and providing anonymity. In Windows, proxy settings can be configured manually or automatically using a proxy auto-configuration (PAC) file.
Users can access these settings through the Settings app under "Network & Internet" and then "Proxy." Here, they can toggle the use of a proxy server, specify the proxy server's IP address and port, and set exceptions for specific addresses.
These configurations help in environments where direct internet connections are restricted, enabling access while controlling and monitoring web traffic. Properly setting up a proxy can enhance security by filtering harmful content and reducing bandwidth usage through caching frequently accessed resources.
Read Proxy Setting using PowerShell
<#
.SYNOPSIS
Query Registery via PowerShell Script Invoke-Command to get the Proxy Settings
.DESCRIPTION
Get Computer List from Text File
Loops through and test accessibility using ping
Invoke Statement to Query Registry Proxy Settings
Export Results to Txt File
.Author
Scott Head
ScriptsByScott.com
#>
#============== Creates an Array ===============
$Array=@()
# ====Gather List of Computers from File ==========
$Computers = Get-Content "C:\temp\GetComputerList.txt"
# =========Loop and Test Ping Access ============
Foreach($ComputerOnline in $Computers){
$Pathtest=Test-Connection $ComputerOnline -Count 1 -Quiet
If($Pathtest){
$Array+=$ComputerOnline
}Else{
$ComputerOnline | Tee-Object C:\temp\No-Access.txt -Append
}
}
# ====Invoke Statement Makes It Happen==========
invoke-command -ComputerName $Array -ScriptBlock {
$Proxy=(Get-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings').proxyServer
If($Proxy -eq $NULL){"$env:Computername Not Found"}Else{"$env:Computername $Proxy"}
} | Tee-Object C:\temp\Proxy-report.txt # Export Shows to Screen & Exports to TxT