Hi,
as title says is it possible to Configure Azure Log Analytics agent(on-prem) to log analytics gateway with Powershell. I know what is possible to do with netsh winhttp set proxy <proxy>:<port>
but then I think all traffic will got to proxy which we don't want. Then it can also be done from the Control Panel but doing that to 10 or even 100 servers would take for ever.
So doing it with Powerhsell or CMD would be best option for us because then it is also can be automated / or scripted.
I found and tried this but I did not get it working, getting error "Cannot find an overload for "SetProxyInfo" and the argument count: "1"" In our environment we don't need to use credentials or password. ip or name and port is enough. Does any have have tips or tricks?
param($ProxyDomainName="http://proxy.contoso.com:80", $cred=(Get-Credential))
# First we get the Health Service configuration object. We need to determine if we
# have the right update rollup with the API we need. If not, no need to run the rest of the script.
$healthServiceSettings = New-Object -ComObject 'AgentConfigManager.MgmtSvcCfg'
$proxyMethod = $healthServiceSettings | Get-Member -Name 'SetProxyInfo'
if (!$proxyMethod)
{
Write-Output 'Health Service proxy API not present, will not update settings.'
return
}
Write-Output "Clearing proxy settings."
$healthServiceSettings.SetProxyInfo('', '', '')
$ProxyUserName = $cred.username
Write-Output "Setting proxy to $ProxyDomainName with proxy username $ProxyUserName."
$healthServiceSettings.SetProxyInfo($ProxyDomainName, $ProxyUserName, $cred.GetNetworkCredential().password)