top of page

PowerShell | Query Proxy Settings

<#
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
#>
#============== Creates an Array ===============

$Array=@()
# ================Gather List of Computers from File =================
$Computers = Get-Content "C:\temp\GetComputerList.txt"
# =================Loop Through Systems 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-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

bottom of page