> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/LabtechConsulting/LabTech-Powershell-Module/llms.txt
> Use this file to discover all available pages before exploring further.

# Update-LTService

> Update the ConnectWise Automate agent to the latest version from the server.

## Synopsis

Downloads and installs the latest (or a specified) version of the LabTech (ConnectWise Automate) agent update package from the server.

## Description

`Update-LTService` updates an already-installed Automate agent without performing a full uninstall/reinstall cycle:

1. Reads the current server address from the registry via `Get-LTServiceInfo`.
2. Queries the server's `Agent.aspx` endpoint to detect the currently advertised agent version.
3. Downloads `LabtechUpdate_<version>.zip` from the server's `/LabTech/Updates/` path.
4. Extracts the archive and runs the self-extractor (`LabtechUpdate.exe`) followed by the updater (`Update.exe`).
5. Restarts the agent services after the update completes.

If `-Version` is omitted, the version advertised by the server is used. The function will not downgrade an agent: if the installed version is equal to or higher than the target version, the update is skipped with a warning.

<Warning>
  `Update-LTService` must be run in a PowerShell session with **Administrator** privileges.

  An existing, working agent installation is required. The function reads the server address from the registry — if no installation is found, it exits with an error.
</Warning>

## Syntax

```powershell theme={null}
Update-LTService [[-Version] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

## Parameters

<ParamField path="Version" type="String">
  The specific agent version to install. If omitted, the function queries the server and
  uses the version currently advertised.

  Must match the pattern `[1-9][0-9]{2}\.[0-9]{1,3}` (e.g., `120.240`).

  The function will skip the update with a warning if:

  * The installed version is already equal to or higher than the requested version.
  * The server's advertised version is higher than the requested version.

  **Example:** `120.240`
</ParamField>

<ParamField path="WhatIf" type="SwitchParameter">
  Shows what actions would be performed without actually executing them. No files are
  downloaded or installed.
</ParamField>

<ParamField path="Confirm" type="SwitchParameter">
  Prompts for confirmation before executing each significant action.
</ParamField>

## Examples

**Update to the version currently advertised by the server:**

```powershell theme={null}
Update-LTService
```

Reads the server address from the registry, queries the server for the latest agent
version, and updates the agent to that version.

***

**Update to a specific version:**

```powershell theme={null}
Update-LTService -Version 120.240
```

Downloads and installs agent version `120.240` from the server, using the server address
stored in the registry.

## Notes

* The server address is always read from the registry via `Get-LTServiceInfo`. There is no `-Server` parameter; the agent must already be installed and registered.
* Update files are downloaded to `%windir%\temp\_LTUpdate` and the folder is cleaned before each update attempt.
* The function stops the agent services before applying the update and restarts them afterward.
* Requires agent version 105.001 or higher on the server for automatic version detection.
