CWSQLQuery Documentation
● Full Product Reference

CWSQLQuery
Documentation

Everything you need to install, activate, and operate the CWSQLQuery plugin inside ConnectWise Automate.

v1.0 — AllSector Technology

Section 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

FieldValue
PlatformConnectWise Automate (hosted & self-hosted)
Framework.NET Framework 4.8 — WinForms DLL
Pricing$75.00 / year per Automate instance
LicenseOffline validation — no internet required after activation
PublisherAllSector Technology (allsector.com)

System Requirements

RequirementMinimum
ConnectWise AutomateAny current hosted or self-hosted version supporting Plugin SDK
.NET Framework4.8 (pre-installed on all modern Windows systems)
Operating SystemWindows 10 / Windows Server 2016 or newer
PermissionsAutomate Control Center user with Plugin Manager access
NetworkNo outbound internet required after license activation

Installation Steps

  • 1

    Purchase & Download
    Purchase from allsector.com. You will receive CWSQLQuery.dll and 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 to CWSQLQuery.dll on 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.

Note for hosted Automate users: On ConnectWise-hosted instances, some query paths route through Automate's internal cache layer. The plugin handles this automatically. See Section 04 for query mode behavior 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

ModeButtonInternal MethodBest 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

✓
Query HistoryDropdown stores last 20 queries. Click to reload. Click Clear to empty.
✓
Read-Only ModeCheckbox — disables Non-Query button. Prevents accidental writes while exploring.
✓
Export CSVClick Export CSV after a SELECT. Saves with filename QueryResult_YYYYMMDD_HHmmss.csv.
✓
Ctrl+Enter ShortcutWhile SQL input is focused, runs Execute Query (Read) immediately.
✓
Unsafe Query WarningSELECT * without LIMIT on large tables triggers a warning before executing.
✓
Destructive Query WarningDELETE, DROP, TRUNCATE, or ALTER triggers a confirmation dialog.

Example Queries

-- View all online agents SELECT ComputerID, Name, LastContact FROM computers WHERE Status = 1 ORDER BY LastContact DESC LIMIT 50
-- Find your Server GUID SELECT Value FROM config WHERE Name = 'ServerGUID'
-- Join computers to clients and locations SELECT c.ComputerID, c.Name, cl.Name AS Client, l.Name AS Location FROM computers c JOIN clients cl ON c.ClientID = cl.ClientID JOIN locations l ON c.LocationID = l.LocationID WHERE c.Status = 1 ORDER BY cl.Name, c.Name LIMIT 100
-- Agents not checked in for 24+ hours SELECT ComputerID, Name, LastContact, ClientID FROM computers WHERE LastContact < DATE_SUB(NOW(), INTERVAL 24 HOUR) AND Status = 1 ORDER BY LastContact ASC LIMIT 50
-- Find computers with specific software installed SELECT c.Name, s.Name AS Software, s.Version FROM computers c JOIN software s ON c.ComputerID = s.ComputerID WHERE s.Name LIKE '%TeamViewer%' ORDER BY c.Name LIMIT 100

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 .lic file.

  • 5

    Confirmed — Click Activate. Validation is instant and fully offline. The status bar shows "Licensed".

How to Find Your Server GUID

-- Method 1: SQL Query (Easiest) SELECT Value FROM config WHERE Name = 'ServerGUID'

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.

⚠ One License Per Instance: Each Automate server (unique Server GUID) requires its own license. Keys are cryptographically bound and will fail validation on any server with a different GUID. Contact AllSector Technology for volume pricing if you operate multiple instances.

Section 04

DATABASE REFERENCE

Core Tables

TablePrimary KeyDescriptionCommon Use Case
computersComputerIDOne row per managed endpoint. Agent status, OS info, last contact.Find offline agents, filter by OS
clientsClientIDTop-level client/customer records.List all clients, join with locations
locationsLocationIDPhysical or logical groupings under a client.Filter agents by site
contactsContactIDUser contacts associated with clients.Pull contact emails
configNameServer configuration key-value pairs. Includes ServerGUID, version, feature flags.Read ServerGUID, check server version
propertiesNamePlugin and system key-value store. Plugin license keys stored here.Read/write plugin settings
scriptsScriptIDAll Automate scripts (definitions, not run history).Find script IDs by name
h_scriptsHistoryIDHistorical script run results (ComputerID, ScriptID, RunTime, LastResult).Audit script execution history
softwareSoftwareIDSoftware inventory from all managed endpoints.Find computers with specific software
commandsCommandIDQueued and completed remote commands. Status: 0=Waiting, 1=Sent, 2=Executing, 3=Success, 4=Error.Check command status, debug stuck commands
groupsGroupIDComputer group definitions for policies and searches.List group members
pluginsPluginIDInstalled Control Center plugins with metadata and DLL binary.List installed plugins, check version numbers

Hosted Automate: Query Mode Behavior

ModeBehavior on HostedReliable For
Execute Query (Read)Routes through GV cache layerAll built-in Automate tables
Execute Non-Query (Write)Always bypasses GV cache — hits DB directlyAll INSERT / UPDATE / DELETE on any table
Execute GetSQL (Raw)Always routes through GV cacheDebugging only — check if a table is cache-visible
Why reads on plugin tables may return -9999: If a table was created at plugin runtime (not install time), the GV cache doesn't know about it. Built-in Automate tables are always readable. This is a ConnectWise platform limitation, not a bug in CWSQLQuery.

External Resources

➤
Automate DB Schemaautomationtheory.org/schema
Community-maintained schema dump
➤
ConnectWise Developer Portaldeveloper.connectwise.com
Registration required

Section 05

TROUBLESHOOTING

SymptomLikely CauseSolution
CWSQLQuery tab does not appear after installationPlugin not enabled or Control Center not restartedOpen Plugin Manager, ensure plugin is checked Enabled. Close and fully reopen Control Center.
License dialog appears every timeLicense key not saved to the databaseRe-enter your license key and click Activate. Contact support@allsector.com if it persists.
Invalid License Key error on activationKey was generated for a different Server GUIDCheck 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 tableGV cache blocking the read on hosted AutomateTry Execute GetSQL (Raw). If it returns -9999, the table is not cache-visible. This is a hosted platform limitation.
SELECT * query hangsLarge table with no LIMIT clauseAlways add LIMIT to queries on large tables: computers, software, h_procentries, commands.
Export CSV produces an empty fileNo query results loaded in the gridRun Execute Query (Read) first, wait for results, then click Export CSV.
Non-Query button is grayed outRead-Only Mode is enabledUncheck the Read-Only Mode checkbox in the button row.
Plugin throws exception on startupAssembly conflict or missing SDK dependencyTry 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.