CWSQLQuery
Documentation
Everything you need to install, activate, and operate the CWSQLQuery plugin inside ConnectWise Automate.
v1.0 — AllSector TechnologySection 01
GETTING STARTED
CWSQLQuery is a ConnectWise Automate Control Center plugin that gives Automate administrators a full-featured SQL query execution console directly inside the Control Center. It provides direct read and write access to the Automate MySQL database without leaving your RMM platform.
Your license key is validated offline, tied to your specific Automate server's GUID — no internet required after activation, no subscription that can silently expire.
Quick Facts
| Field | Value |
|---|---|
| Platform | ConnectWise Automate (hosted & self-hosted) |
| Framework | .NET Framework 4.8 — WinForms DLL |
| Pricing | $75.00 / year per Automate instance |
| License | Offline validation — no internet required after activation |
| Publisher | AllSector Technology (allsector.com) |
System Requirements
| Requirement | Minimum |
|---|---|
| ConnectWise Automate | Any current hosted or self-hosted version supporting Plugin SDK |
| .NET Framework | 4.8 (pre-installed on all modern Windows systems) |
| Operating System | Windows 10 / Windows Server 2016 or newer |
| Permissions | Automate Control Center user with Plugin Manager access |
| Network | No outbound internet required after license activation |
Installation Steps
- 1
Purchase & Download
Purchase from allsector.com. You will receiveCWSQLQuery.dlland this documentation. - 2
Open Plugin Manager
In Automate Control Center, navigate to the Plugin Manager (typically under System Dashboard). - 3
Add Plugin
Click Add Plugin and browse toCWSQLQuery.dllon your local machine. - 4
Configure
Fill in Name = "CWSQLQuery" and Author = "AllSector Technology", then click OK. - 5
Enable the Plugin
Check the Enable checkbox next to the plugin in the Plugin Manager list. - 6
Restart Control Center
Close and reopen ConnectWise Automate Control Center to load the plugin. - 7
Locate the Tab
Navigate to System Dashboard. You should now see an CWSQLQuery tab. - 8
Activate License
On first launch you will be prompted to enter your license key. See Section 03 for details.
Section 02
USING THE CONSOLE
The console window is organized into four zones: Query History (dropdown, last 20 queries), SQL Input (Consolas font, dark-themed editor), Button Row (execution controls), and Results Area (DataGridView or raw text panel).
Execution Modes
| Mode | Button | Internal Method | Best For |
|---|---|---|---|
| Execute Query (Read) | Blue | _host.Query(sql) |
SELECT statements — returns DataGridView. Keyboard: Ctrl+Enter |
| Execute Non-Query (Write) | Dark Red | ExecuteNonQuery(sql) |
INSERT, UPDATE, DELETE. Bypasses GV cache. Disabled when Read-Only Mode is on. |
| Execute GetSQL (Raw) | Gray | _host.GetSQL(sql) |
Debugging GV cache behavior. Returns raw string. A result of -9999 = table not cache-visible. |
Features Reference
QueryResult_YYYYMMDD_HHmmss.csv.SELECT * without LIMIT on large tables triggers a warning before executing.Example Queries
Section 03
LICENSE & ACTIVATION
CWSQLQuery uses offline license validation. Once activated it never needs to contact the internet again. Your license key is an HMAC-SHA256 hash of your Automate Server GUID, formatted as ASQL-XXXX-XXXX-XXXX-XXXX. It is stored in the Automate database in the properties table.
Purchase & Activation Flow
- 1
Purchase — Purchase at allsector.com ($75/year). Find your Automate Server GUID (see below) and provide it at checkout.
- 2
Key Generation — AllSector generates your license key bound to your Server GUID and emails it automatically.
- 3
Open License Dialog — In Automate Control Center, open the CWSQLQuery tab. The License dialog appears on first run.
- 4
Activate — Paste the license key into the dialog or click "Browse for License File" and select the provided
.licfile. - 5
Confirmed — Click Activate. Validation is instant and fully offline. The status bar shows "Licensed".
How to Find Your Server GUID
Method 2 — Control Center: Navigate to System Dashboard → Config and look for a row labeled ServerGUID.
Method 3 — License Dialog: Install the plugin and open the CWSQLQuery tab. The activation dialog displays your Server GUID at the top before you enter a key.
Section 04
DATABASE REFERENCE
Core Tables
| Table | Primary Key | Description | Common Use Case |
|---|---|---|---|
computers | ComputerID | One row per managed endpoint. Agent status, OS info, last contact. | Find offline agents, filter by OS |
clients | ClientID | Top-level client/customer records. | List all clients, join with locations |
locations | LocationID | Physical or logical groupings under a client. | Filter agents by site |
contacts | ContactID | User contacts associated with clients. | Pull contact emails |
config | Name | Server configuration key-value pairs. Includes ServerGUID, version, feature flags. | Read ServerGUID, check server version |
properties | Name | Plugin and system key-value store. Plugin license keys stored here. | Read/write plugin settings |
scripts | ScriptID | All Automate scripts (definitions, not run history). | Find script IDs by name |
h_scripts | HistoryID | Historical script run results (ComputerID, ScriptID, RunTime, LastResult). | Audit script execution history |
software | SoftwareID | Software inventory from all managed endpoints. | Find computers with specific software |
commands | CommandID | Queued and completed remote commands. Status: 0=Waiting, 1=Sent, 2=Executing, 3=Success, 4=Error. | Check command status, debug stuck commands |
groups | GroupID | Computer group definitions for policies and searches. | List group members |
plugins | PluginID | Installed Control Center plugins with metadata and DLL binary. | List installed plugins, check version numbers |
Hosted Automate: Query Mode Behavior
| Mode | Behavior on Hosted | Reliable For |
|---|---|---|
| Execute Query (Read) | Routes through GV cache layer | All built-in Automate tables |
| Execute Non-Query (Write) | Always bypasses GV cache — hits DB directly | All INSERT / UPDATE / DELETE on any table |
| Execute GetSQL (Raw) | Always routes through GV cache | Debugging only — check if a table is cache-visible |
External Resources
Section 05
TROUBLESHOOTING
| Symptom | Likely Cause | Solution |
|---|---|---|
| CWSQLQuery tab does not appear after installation | Plugin not enabled or Control Center not restarted | Open Plugin Manager, ensure plugin is checked Enabled. Close and fully reopen Control Center. |
| License dialog appears every time | License key not saved to the database | Re-enter your license key and click Activate. Contact support@allsector.com if it persists. |
| Invalid License Key error on activation | Key was generated for a different Server GUID | Check the Server GUID shown in the license dialog. If it differs from what you sent AllSector, contact support with your current GUID. |
| Execute Query returns 0 rows on a known table | GV cache blocking the read on hosted Automate | Try Execute GetSQL (Raw). If it returns -9999, the table is not cache-visible. This is a hosted platform limitation. |
| SELECT * query hangs | Large table with no LIMIT clause | Always add LIMIT to queries on large tables: computers, software, h_procentries, commands. |
| Export CSV produces an empty file | No query results loaded in the grid | Run Execute Query (Read) first, wait for results, then click Export CSV. |
| Non-Query button is grayed out | Read-Only Mode is enabled | Uncheck the Read-Only Mode checkbox in the button row. |
| Plugin throws exception on startup | Assembly conflict or missing SDK dependency | Try Remove + Re-add the plugin DLL via Plugin Manager. Contact AllSector support with the exact error message. |
Need Help?
Contact AllSector Support
Include your Server GUID, the exact error message or symptom, and whether you are on hosted or self-hosted Automate.