Synopsis
Starts theLTService and LTSvcMon Windows services on the local machine. Before starting, the function checks for any process occupying the agent’s TrayPort (default 42000). If a conflicting process is found, it attempts to kill it. If the process cannot be killed (e.g., a protected application), the TrayPort is incremented by one (wrapping back to 42000 after 42009) and written to the registry.
Syntax
Parameters
Shows what would happen if the command runs without actually executing it. No services are started and no registry changes are made.
Prompts for confirmation before starting the services.
Behavior
- Both
LTServiceandLTSvcMonmust already be installed. The function returns an error if either service is not found. - Before starting, the TrayPort is read from
HKLM:\SOFTWARE\LabTech\Service. If the value is absent, port42000is used. - Both services are set to Automatic startup type before being started via
sc.exe. - After issuing the start command, the function polls LTService every 2 seconds for up to 1 minute waiting for it to reach the
Runningstate. - Once the service reaches
Running, aSend Statuscommand is issued viaInvoke-LTServiceCommandto trigger an immediate agent check-in.
The 1-minute wait only applies when both services were actually started by this call. If the services were already running, no wait occurs.