none
How to display the proxy settings for a specific group of servers in an OU ? RRS feed

  • Question

  • Hi,

    Can anyone here please assist me in how to display the value of Proxy server settings from the computers in a specific OU member ?

    $Computers = Get-ADComputer -Filter * -SearchBase "OU=Terminal Servers,OU=Servers,DC=domain,DC=com" | Where-Object { Test-Connection $_.Name -Count 1 -Quiet }
    ForEach ($Computer in $Computers) {
    	? .... ?
    	| Export-csv "C:\Proxy-Setting-Results.csv" -Append -NoTypeInformation -UseCulture
    } 

    I've done similar script for some other task but not sure how to do this for Proxy setting.

    Thanks.


    /* Server Support Specialist */

    Wednesday, April 8, 2015 5:41 AM

Answers

  • As I posted.  IE is set per user.  NETSH cannot show you that.  You cannot remotely or locally get the per user proxy settings.  You can for the current user but the machine proxy can only be obtained by using NETSH.

    You need to sort out the difference between these items.  They are not the same.


    \_(ツ)_/

    Wednesday, April 8, 2015 10:13 PM

All replies

  • People,

    Can anyone here please assist me with the script below to list Server Name, the current Windows Proxy server & port in use into CSV ?


    Import-Module ActiveDirectory

    $Computers = Get-ADComputer -Filter * -SearchBase "OU=Production Servers,OU=Servers,DC=domain,DC=com" |

    Where-Object { Test-Connection $_.Name -Count 1 -Quiet }

    ForEach ($Computer in $Computers) {

    .

    .

    .

    | Export-csv "C:\Proxy-Setting.csv" -Append -NoTypeInformation -UseCulture

    }


    Thanks in advance.


    /* Server Support Specialist */


    Wednesday, April 8, 2015 6:00 AM
  • Proxy settings are not set in Active Directory

    The below code works for 2003 servers and Win XP

    $colItems = get-wmiobject -class "Win32_Proxy" -namespace "root\CIMV2" ` 
    -computername $env:computername
     
    foreach ($objItem in $colItems) { 
          write-host "Caption: " $objItem.Caption 
          write-host "Description: " $objItem.Description 
          write-host "Proxy Port Number: " $objItem.ProxyPortNumber 
          write-host "Proxy Server: " $objItem.ProxyServer 
          write-host "Server Name: " $objItem.ServerName 
          write-host "Setting ID: " $objItem.SettingID 
          write-host 
    } 

    You can try checking the registry values- Works in 2008 + and Windows 7

    Get-Item 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings'

    or use netsh

    netsh winhttp show proxy -r <remotemachinename>


    Regards Chen V [MCTS SharePoint 2010]

    Wednesday, April 8, 2015 7:05 AM
  • Proxy servers can be set per user in IE and will not show up in WMI or NETSH.  Proxy can and is usually set by Group Policy.  Proxy can also be set to AUTO and is then controlled by IS or IIS.


    \_(ツ)_/


    • Edited by jrv Wednesday, April 8, 2015 8:00 AM
    Wednesday, April 8, 2015 7:23 AM
  • Proxy servers can be set per user in IE and will not show up in WMI or NETSH.  Proxy can and is usually set by Group Policy.  Proxy can also be set to AUTO and is then controlled by IS or IIS.


    \_(ツ)_/


    Yes, so if the proxy value is set by the GPO, then how can I view that value for each of the servers within the specific OU ?


    /* Server Support Specialist */

    Wednesday, April 8, 2015 10:12 AM
  • If it is set per-user as is normally the case you cannot query the servers for the setting.

    By default servers do not have a proxy setting so if you haven't set it explicitly then there is no setting.  There is generally no need for a setting.  Servers don't contact the Internet. If you are trying to do windows Update and have a proxy server then the Proxy server can be set to allow the server out and the system proxy can be set using netsh or via Group Policy.  In that case you can use WMI to retrieve the setting.


    \_(ツ)_/

    Wednesday, April 8, 2015 10:21 AM
  • If it is set per-user as is normally the case you cannot query the servers for the setting.

    By default servers do not have a proxy setting so if you haven't set it explicitly then there is no setting.  There is generally no need for a setting.  Servers don't contact the Internet. If you are trying to do windows Update and have a proxy server then the Proxy server can be set to allow the server out and the system proxy can be set using netsh or via Group Policy.  In that case you can use WMI to retrieve the setting.


    \_(ツ)_/

    OK, so in that case using WMI, what is the line that I can/ should put to my script above ?


    /* Server Support Specialist */

    Wednesday, April 8, 2015 12:42 PM
  • WMI is obsolete except for WS2003R2.  For all others use:

    netsh winhttp show proxy

    https://technet.microsoft.com/en-us/library/bb430772(v=exchg.141).aspx


    \_(ツ)_/

    Wednesday, April 8, 2015 2:15 PM
  • WMI is obsolete except for WS2003R2.  For all others use:

    netsh winhttp show proxy

    https://technet.microsoft.com/en-us/library/bb430772(v=exchg.141).aspx


    \_(ツ)_/

    Many thanks JRV for the suggestion. Somehow it is still doesn't show the proxy server name after I manually set the proxy server address in the Internet Explorer.


    /* Server Support Specialist */

    Wednesday, April 8, 2015 10:10 PM
  • As I posted.  IE is set per user.  NETSH cannot show you that.  You cannot remotely or locally get the per user proxy settings.  You can for the current user but the machine proxy can only be obtained by using NETSH.

    You need to sort out the difference between these items.  They are not the same.


    \_(ツ)_/

    Wednesday, April 8, 2015 10:13 PM