Skip to main content

Overview

The LabTech PowerShell module maintains an in-memory proxy object ($Script:LTProxy) that is applied automatically to every download operation — including Install-LTService, Uninstall-LTService, and Update-LTService. Two functions manage this state: Proxy settings are stored in the agent registry as encoded strings. Set-LTProxy handles encoding automatically using ConvertTo-LTSecurity before writing.

Reading current proxy settings

Get-LTProxy has no parameters. It reads from the installed agent’s registry settings first. If no agent is present, it falls back to the system-level proxy discovery. The discovered settings are loaded into $Script:LTProxy for use by all module functions during the current session, and the object is returned.
Example output:

Setting a proxy server

Use Set-LTProxy -ProxyServerURL to configure the proxy for module operations and for the installed agent.
When an agent is installed and running, Set-LTProxy encodes the username and password with ConvertTo-LTSecurity, writes them to HKLM:\SOFTWARE\LabTech\Service\Settings, and restarts LTService and LTSvcMon for the changes to take effect.

Using encoded credentials

If the proxy credentials are already encoded with the agent password (for example, from a backup or existing registry values), use the EncodedProxyUsername and EncodedProxyPassword parameters. The module decodes them using ConvertFrom-LTSecurity before applying.

Auto-detecting system proxy

-DetectProxy instructs Set-LTProxy to use [System.Net.WebRequest]::GetSystemWebProxy() and netsh winhttp show proxy to discover the proxy in use on the system. Detected settings are applied to both the module session and the agent registry.

Disabling the proxy

-ResetProxy clears all proxy settings from the module session and from the agent registry.
After resetting, $Script:LTProxy.Enabled is $False and a plain System.Net.WebProxy (no proxy) is assigned to the module’s web client.

How proxy settings apply to downloads

When $Script:LTProxy.Enabled is $True, all web requests made by the module automatically route through the configured proxy. This includes:
  • Install-LTService — MSI download from the server or installer token URL
  • Uninstall-LTService — uninstall MSI and Agent_Uninstall.exe downloads
  • Update-LTServiceLabtechUpdate_<version>.zip download
The proxy is applied at the System.Net.WebRequest level before each download:
This means calling Get-LTProxy (or Set-LTProxy) before any install or update operation ensures the correct proxy is in use for the entire operation.
If you are deploying to systems where the module runs before the agent is installed, call Set-LTProxy explicitly with the correct URL before calling Install-LTService. The proxy will be written to the agent’s registry as part of the install process.