Health Service Proxy Configuration Write Action
Microsoft.IntelligencePacks.Types.HealthServiceProxyConfigurationWriteAction (WriteActionModuleType)
Module that synchronizes the Advisor proxy settings for the Health Service to use.
Element properties: Member Modules:
Overrideable Parameters:
Source Code: <WriteActionModuleType ID="Microsoft.IntelligencePacks.Types.HealthServiceProxyConfigurationWriteAction" Accessibility="Internal" Batching="false">
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="WebProxyAddress" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ProxyAuthenticationDomainName" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ProxyAuthenticationUserName" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ProxyAuthenticationPassword" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ScriptTimeoutSeconds" type="xsd:integer"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="ScriptTimeoutSeconds" Selector="$Config/ScriptTimeoutSeconds$" ParameterType="int"/>
<OverrideableParameter ID="WebProxyAddress" Selector="$Config/WebProxyAddress$" ParameterType="string"/>
</OverrideableParameters>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<WriteAction ID="WA" TypeID="Windows!Microsoft.Windows.PowerShellWriteAction">
<ScriptName>HealthServiceProxyConfigurationSynchronization.ps1</ScriptName>
<ScriptBody><Script> param($WebProxyAddress, $ProxyDomainName, $ProxyUserName, $ProxyPassword)
# 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
}
if ($WebProxyAddress -eq '')
{
Write-Output "Clearing proxy settings."
$healthServiceSettings.SetProxyInfo('', '', '')
}
else
{
if ($ProxyDomainName -ne '')
{
$ProxyUserName = $ProxyDomainName + '\' + $ProxyUserName
}
try
{
$proxyValue = New-Object -TypeName 'System.Uri' -ArgumentList $WebProxyAddress, [System.UriKind.Absolute]
if (($proxyValue.Port -ne 80) -and ($proxyValue.Port -ne -1))
{
$proxyHost = $proxyValue.Host + ":" + $proxyValue.Port
}
elseif ($proxyValue.Host -eq '')
{
# The URL was something weird we couldn't get a host out of.
$proxyHost = $proxy.Value
}
else
{
$proxyHost = $proxyValue.Host
}
}
catch
{
$proxyHost = $WebProxyAddress
}
Write-Output "Setting Proxy to ${proxyHost} with proxy username of (${ProxyUserName})."
$healthServiceSettings.SetProxyInfo($proxyHost, $ProxyUserName, $ProxyPassword)
}</Script> </ScriptBody>
<Parameters>
<Parameter>
<Name>WebProxyAddress</Name>
<Value>$Config/WebProxyAddress$</Value>
</Parameter>
<Parameter>
<Name>ProxyDomainName</Name>
<Value>$Config/ProxyAuthenticationDomainName$</Value>
</Parameter>
<Parameter>
<Name>ProxyUserName</Name>
<Value>$Config/ProxyAuthenticationUserName$</Value>
</Parameter>
<Parameter>
<Name>ProxyPassword</Name>
<Value>$Config/ProxyAuthenticationPassword$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>$Config/ScriptTimeoutSeconds$</TimeoutSeconds>
</WriteAction>
</MemberModules>
<Composition>
<Node ID="WA"/>
</Composition>
</Composite>
</ModuleImplementation>
<InputType>System!System.BaseData</InputType>
</WriteActionModuleType>