Synopsis
Performs a full reinstall of the LabTech (ConnectWise Automate) agent by combiningUninstall-LTService and Install-LTService in a single operation, automatically reading current settings from the registry.
Description
Redo-LTService is a convenience wrapper that orchestrates a complete agent reinstall:
- Reads current agent settings (server URL, location ID) from the registry via
Get-LTServiceInfo. - If the agent is not currently installed, falls back to
Get-LTServiceInfoBackupto recover settings from a prior backup. - Optionally runs
New-LTServiceBackupif-Backupis specified. - Calls
Uninstall-LTServicewith the gathered server address. - Waits 20 seconds for the uninstall to settle.
- Calls
Install-LTServicewith the gathered (or overridden) settings.
ReInstall-LTService.
Syntax
Parameters
The URL to the LabTech/Automate server. Used for both the uninstall and reinstall steps.If not provided, the function attempts to read the server address from the registry via
Get-LTServiceInfo. If the agent is not installed, it tries Get-LTServiceInfoBackup.
If neither source is available, the function prompts interactively.Accepts pipeline input by property name and by value.Example: https://lt.domain.comThe system password agents use to authenticate with the server.Retrieve this value from the server database with:Alias:
Password. Accepts pipeline input by property name. Mutually exclusive with
-InstallerToken.An installer token for customized MSI downloads via
Deployment.aspx. Use as an
alternative to -ServerPassword.Pattern: [0-9a-z]+ (lowercase alphanumeric only).Mutually exclusive with -ServerPassword.The Location ID the agent should be placed into after reinstall.If not provided, the function reads the current LocationID from the registry. If that
also fails, it prompts interactively. Defaults to
1 if nothing is found.If specified, runs
New-LTServiceBackup before the uninstall step, preserving
current agent settings for later recovery.If specified, passes
-Hide to Install-LTService to hide the agent entry in
Add/Remove Programs after reinstall.If provided, passes
-Rename to Install-LTService to rename the agent entry in
Add/Remove Programs to the specified string after reinstall.Skips the .NET Framework 3.5 and .NET 2.0 prerequisite checks during reinstall.
Passed through to
Install-LTService.Allows the operation to proceed on a probe agent. Without this switch, probe agents
are protected from reinstall.
Shows what actions would be performed without actually executing them.
Prompts for confirmation before executing each significant action.
Examples
Reinstall using settings from the registry:Reinstall with explicit server, password, and location:
Notes
- This function is also available as the alias
ReInstall-LTService. - A 20-second delay is introduced between the uninstall and install steps to allow services and file handles to fully release.
- The server password is redacted in all verbose/output messages during execution.
-Forceis implicitly passed toUninstall-LTServiceandInstall-LTServiceinternally during the redo operation.