ConnectWiseAutomateAgent
2.2.0-alpha0031
PowerShell module for working with the ConnectWise Automate Agent.
Minimum PowerShell version
3.0
Installation Options
Owners
Copyright
(c) 2026 Chris Taylor. All rights reserved.
Package Details
Author(s)
- Chris Taylor
Tags
ChrisTaylorCodes ConnectWise Automate LabTech RMM
Functions
Hide-CWAAAddRemove Rename-CWAAAddRemove Show-CWAAAddRemove Install-CWAA Redo-CWAA Uninstall-CWAA Update-CWAA Get-CWAAError Get-CWAALogLevel Get-CWAAProbeError Set-CWAALogLevel Get-CWAAProxy Set-CWAAProxy ConvertTo-CWAAScriptOutput Initialize-CWAAScriptLog Invoke-CWAAPwsh Invoke-CWAAScript New-CWAARemoteMonitor New-CWAAScriptOutput Write-CWAAScriptLog Register-CWAAHealthCheckTask Repair-CWAA Repair-CWAAEmptyMac Restart-CWAA Start-CWAA Stop-CWAA Test-CWAAHealth Unregister-CWAAHealthCheckTask Get-CWAAInfo Get-CWAAInfoBackup Get-CWAASettings New-CWAABackup Reset-CWAA ConvertFrom-CWAASecurity ConvertTo-CWAASecurity Invoke-CWAACommand Test-CWAAPort Test-CWAAServerConnectivity
Dependencies
This module has no dependencies.
Release Notes
## [2.2.0-alpha0031] - 2026-12-02
### Fixed
- The module failed to load on PowerShell 2.0 (Windows 7 / Server 2008 R2 as shipped) with "Parameter attributes need to be a constant or a script block": `Wait-CWAACondition` and `Repair-CWAA` used `[ValidateRange(1, [int]::MaxValue)]`, which PowerShell 2.0 rejects. Every 2.2.0 pre-release so far had this, so the PowerShell 2.0 support described below never worked on a real 2.0 machine. The compatibility test now rejects attribute arguments that are not literal values. Checked by loading the module on six Windows 7 / 2008 R2 machines running PowerShell 2.0, one of them 32-bit.
### Added
- **Script helpers** for scripts run from ConnectWise Automate: `Initialize-CWAAScriptLog`, `Write-CWAAScriptLog`, `New-CWAAScriptOutput`, `ConvertTo-CWAAScriptOutput`, `Invoke-CWAAScript`, `Invoke-CWAAPwsh`, and `New-CWAARemoteMonitor`. See `Examples/ScriptHelper-*.ps1`. Output values are kept to one line (line breaks become ` / `, pipes become `/`). `Invoke-CWAAPwsh` only runs pwsh.exe from Program Files, the PowerShellCore registry install locations, or `-PwshPath`, never from PATH; it reports stderr output as `Status=Error`.
- Aliases for the Script helpers that keep the names from the legacy `CW-Automate-ScriptHelper.ps1`: `Initialize-AutomateLogging`, `Write-AutomateLog`, `New-AutomateOutput`, `ConvertTo-AutomateOutput`, `Invoke-CWAScript`, `Invoke-LTPwsh`, and `New-CWARemoteMonitor`. Scripts that still dot-source the old helper file after importing the module will replace these names with the old definitions.
- Event ID 4023, written by `Register-CWAAHealthCheckTask` when the scheduled task is missing right after it was created.
- Event ID 1013, written by `Uninstall-CWAA` when it renames an agent folder it could not delete (see Changed).
- `Repair-CWAAEmptyMac` (alias `Repair-LTEmptyMac`) gets an agent signed up when a network adapter with no MAC address, such as NordVPN's NordLynx (WireGuard), holds the preferred route. The agent then records an empty MAC and the Automate server rejects every sign-up ("Empty MAC Blacklisted"). It disables those adapters, restarts the agent services, waits for an agent ID (`-TimeoutSeconds`, default 600) and enables the adapters again. It changes nothing when the agent already has an ID, when no adapter without a MAC has a default route, or when no other adapter with a MAC has one (disabling would take the computer offline). A one-time scheduled task, running as SYSTEM after the timeout plus 5 minutes (or on wake), enables the adapters again if the repair is interrupted. Events 2040-2043.
- `Install-CWAA -DisableMacLessAdapters` and `Redo-CWAA -DisableMacLessAdapters` run `Repair-CWAAEmptyMac` when the sign-up fails for that reason, inside the 15-minute registration window. Disabling adapters is opt-in.
### Security
- Folder removal during uninstall and update no longer follows junctions or symbolic links inside the folder. A link is deleted as a link and its target is left untouched. Previously a link planted inside `C:\Windows\Temp\_ltupdate` could make the elevated cleanup delete files elsewhere.
- `Invoke-CWAAScript -URL` only accepts `https://` URLs. TLS 1.2 is added for the download when the process setting lacks it, and the previous setting is restored afterwards.
- `Initialize-CWAAScriptLog` refuses a log directory whose path passes through a junction or symbolic link, and creates each log file exclusively instead of appending to an existing file. The default log directory is `%windir%\LTSVC\logs`.
- `Invoke-CWAAPwsh` never searches `PATH` for pwsh.exe (see Added). Parameter values passed with `-Parameters` are visible on the pwsh.exe command line, so do not pass secrets that way.
- `ConvertTo-CWAASecurity` and `ConvertFrom-CWAASecurity` no longer write the encryption key (or, when encoding, the plain text) to the debug stream. `-Debug` output shows a short hash instead.
### Changed
- `Install-CWAA` (and `Redo-CWAA`) stops waiting for registration once the agent's sign-up has failed because a network adapter with no MAC address holds the preferred route, and reports which adapter it is, with Event 1003 (Warning). Previously it waited the full 15 minutes and reported only that the agent failed to register. The check needs a "Failed Signup" entry in `LTErrors.txt` since LTService started, so a slow sign-up is not cut short.
- `Repair-CWAA`'s check for other running repairs no longer matches `Repair-CWAAEmptyMac`, so the health check cannot stop it while network adapters are disabled.
- `Uninstall-CWAA` renames `C:\Windows\LTSVC` or `C:\Windows\Temp\_ltupdate` to `<name>.old-<timestamp>` when Windows will not delete it ("The directory is not empty" until a reboot). Previously the uninstall reported "Remnants of previous install still detected" and `Install-CWAA` / `Redo-CWAA` stopped. A warning and Event 1013 record the rename, the uninstall's success message and Event 1010 (as a Warning) list the renamed folders, and a later uninstall removes them. The delete is tried a second time after 2 seconds before renaming. The folder is not renamed when Windows has file operations scheduled under it for the next reboot (`PendingFileRenameOperations` or `PendingFileRenameOperations2`), since those would act on the new install.
- `Install-CWAA` (and `Redo-CWAA`) waits up to 30 seconds for the LTService service to appear after msiexec returns before counting the attempt as failed. The service often registers a few seconds late, which previously printed "Service Failed to Install. Retrying in 30 seconds." on installs that had worked. Retry warnings and the final error now include the msiexec exit code (for example `1618, another installation is already in progress`), and the final error names the MSI log. A failed MSI step now also writes Event 1002.
- `Install-CWAA` retries the installer download up to 3 times when the server returns an empty or incomplete file (for example a 0 KB `Agent_Install.zip`) or the download throws. If no attempt gives a complete file, the error now says the installer could not be downloaded from that server (with a warning per attempt) and writes Event 1002, instead of "No valid server was reached to use for the install." A download exception no longer ends `Install-CWAA` before its cleanup runs.
- `Uninstall-CWAA`'s "Remnants of previous install still detected" error and Event 1011 now list what was left behind (the `LTSVC` or `_ltupdate` folder, or the `LabTech\Service` registry key), so a locked folder can be told apart from a registry key that would not delete. The check now also covers the install folder named in the registry when it is not the default `C:\Windows\LTSVC`; previously a leftover there was reported as a successful uninstall.
- `Register-CWAAHealthCheckTask -Force` on a task that already exists now returns `Updated = $true` (and logs "updated") instead of `Created = $true`. `Created` is only true when no task existed before.
- `Register-CWAAHealthCheckTask` writes the task definition to a uniquely named temporary file instead of a fixed `CWAAHealthCheckTask.xml`, because the file holds the installer token.
- Dependabot pull requests now target `develop`, the pre-commit hook (`.githooks/pre-commit`) works on Windows and runs `Invoke-QuickTest.ps1`, and `Tests/Invoke-AllTests.ps1` uses the pinned Pester in both modes and fails when the build fails.
- Build and test tooling synced with the GitHub-Template (Nov 2026): Pester 6, Sampler 0.120, PSResourceGet dependency resolution with version ranges in `RequiredModules.psd1`, and a new `Assert_RequiredModule_Versions` build task. Build tooling now requires PowerShell 7.6+; the module itself still supports PowerShell 3.0+.
- Markdown command help is now generated with Microsoft.PowerShell.PlatyPS 1.x (`./build.ps1 -Tasks docs`) into `Docs/Help/ConnectWiseAutomateAgent/`. `Docs/Help/ConnectWiseAutomateAgent.md` remains the hand-written function index. The per-function pages moved from `Docs/Help/<Function>.md` to `Docs/Help/ConnectWiseAutomateAgent/<Function>.md`, so links to the old paths no longer resolve.
- CI hardening: actions pinned to commit SHAs (checkout v7, upload-artifact v7, download-artifact v8) and kept current by Dependabot, read-only default permissions, no `${{ }}` interpolation inside scripts, publish concurrency, `Publish-PSResource`, and builds on `fix/`, `chore/`, `docs/` and `feature/` branches. Publishing now fails on a duplicate PSGallery version instead of silently skipping (re-runs still skip).
- `Invoke-QuickTest.ps1` now uses the pinned modules in `output/RequiredModules`, always tests `source/`, fails on failed blocks/containers or zero tests, and always emits JSON in `-OutputFormat Structured`.
- `test-local.ps1` now runs tests through the build pipeline (same configuration as CI), also checks tooling scripts for analyzer errors, and restores `PSModulePath` afterwards.
### Removed
- The `publish` build workflow (`./build.ps1 -Tasks publish`). Publishing to the PowerShell Gallery happens only in CI.
- The `Pester_if_Code_Coverage_Under_Threshold` build task.
- The stale MAML help file (`en-US/ConnectWiseAutomateAgent-help.xml`) and the manifest's `HelpInfoURI`. Nothing generated the file any more and it did not cover the Script helpers. `Get-Help` is unchanged: it reads the comment-based help in each function.
### Fixed
- The example deployment scripts could not run on PowerShell 2.0: the module bootstrap used `*>$null` (a parse error there) and a TLS 1.2 line that does nothing on .NET 3.5, and the GPO example used `Get-CimInstance`. The README now gives a direct download form that works on Windows 7 / Server 2008 R2.
- Module source is now ASCII only. The single-file module has no byte order mark, so Windows PowerShell decoded its em dashes as characters that include a double quote when it was loaded by direct download. They were all in comments, so nothing broke, but one
FileList
- ConnectWiseAutomateAgent.nuspec
- ConnectWiseAutomateAgent.psd1
- ConnectWiseAutomateAgent.psm1
- en-US\about_ConnectWiseAutomateAgent.help.txt
Version History
| Version | Downloads | Last updated |
|---|---|---|
| 2.2.0-alpha0031 (current version) | 6 | 12/2/2026 |
| 2.2.0-alpha0023 | 6 | 12/2/2026 |
| 2.2.0-alpha0016 | 6 | 12/2/2026 |
| 2.2.0-alpha0010 | 5 | 11/15/2026 |
| 2.2.0-alpha0005 | 3 | 11/13/2026 |
| 2.2.0-alpha0001 | 17 | 7/27/2026 |
| 2.1.0 | 7,138,261 | 6/18/2026 |
| 2.1.0-alpha0011 | 4 | 6/17/2026 |
| 2.1.0-alpha0005 | 4 | 6/17/2026 |
| 2.1.0-alpha0001 | 10 | 2/4/2026 |
| 2.0.0 | 71,790 | 2/4/2026 |
| 0.1.4.0 | 138,988 | 10/2/2024 |
| 0.1.3.0 | 64,252 | 12/1/2023 |
| 0.1.2.0 | 1,395,228 | 8/15/2022 |
| 0.1.1.0 | 28,948 | 8/18/2021 |
| 0.1.0.0 | 687 | 7/16/2021 |