DBLense Script Runner — Complete User Guide
Execute SQL scripts across multiple servers and databases in one click. Run scripts sequentially, in parallel, or in batches — then export results to Excel or CSV. All from a single portable .exe.
Getting Started
- Create a Server Group — Click + in the Server Groups toolbar. Enter a name like "Production" or "Dev/Test".
- Add Servers — Click + Add Server. Enter your server details and test the connection.
- Load Databases — Select target servers, then click
Load Databases.
- Write or Load a Script — Type SQL in the editor tab, or switch to Script Folder tab.
- Execute — Click ▶ Execute and watch results stream in.
Server Group Management
Creating Groups
Groups are organizational containers — create groups like "Production Servers", "Staging", "Azure SQL", or "DR Cluster".
Adding Servers
| Field | Description |
|---|---|
| Server Name | Full server/instance name (e.g., SQLPROD01, myserver.database.windows.net) |
| Display Name | Optional short label. Useful for long Azure MI names. Full name visible as tooltip. |
| Authentication | Choose from four modes (see below) |
| Login / Password | Required for SQL and Entra ID auth modes |
Click Test Connection to verify connectivity before saving.
Selection Controls
- Checkboxes on groups and servers control which targets are included
- Checking a group toggles all servers within it
- ☑ Select All / ☐ Deselect All buttons apply to all groups
Authentication Modes
| Mode | Use Case | Fields Required |
|---|---|---|
| Windows Authentication | Domain-joined on-premises servers | None — uses Windows credentials |
| SQL Server Authentication | SQL login/password access | Login + Password |
| Entra ID (Password) | Azure SQL with Entra credentials | Login + Password |
| Entra ID (MFA) | Azure SQL with multi-factor auth | Login only (interactive) |
Passwords are encrypted using Windows DPAPI — they are never saved as plain text.
Script Editor
Type or paste SQL directly into the built-in editor with:
- Multi-line input with Tab key support
- Monospace font (Cascadia Code / Consolas)
- Horizontal and vertical scrolling
Script Folder
Run multiple .sql files from a folder:
- Click Browse... and select a folder
- All
.sqlfiles are listed with checkboxes, filename, and file size - Use Select All / Deselect All to toggle
- Scripts are listed alphabetically (top-level only, no subfolder recursion)
Target Databases
After selecting servers, click Load Databases. Three quick filters:
| Filter | Selects |
|---|---|
| All | Every database on the server |
| User (default) | Only user databases (excludes master, model, msdb, tempdb) |
| System | Only system databases |
master database.Execution Modes
| Mode | Behavior | Best For |
|---|---|---|
| Sequential (default) | One target at a time, in order | Data-modifying scripts, first-time runs |
| Parallel | ALL targets concurrently | Read-only queries across many servers |
| Batched | Groups of N (configurable), batch by batch | Balanced speed & resource control |
Error Handling
| Mode | Behavior |
|---|---|
| Continue on Error (default) | Proceeds through all targets, logs failures |
| Stop on Error | Halts remaining work after first failure |
GO Batch Splitting
- Scripts are split on standalone
GOlines (case-insensitive) - GO with repeat count:
GO 5runs the preceding batch 5 times GOinside string literals, block comments, and line comments is correctly ignored- False positives like
GOTOorGOPHERare not treated as separators - Empty batches are automatically skipped
- Each batch has a 300-second timeout
Results
Script Results Tab
All result rows merged into a single data grid with two auto-prepended columns: Instance Name and Database Name. Supports sorting and column resizing.
Execution Summary Tab
| Column | Description |
|---|---|
| Status | ✓ (success) or ✗ (failure) |
| Script | Script filename (folder mode) |
| Group / Server / Database | Target details |
| Rows | Rows returned or affected |
| Duration | Execution time |
| Error | Error message (if failed) |
Execution Log Tab
Timestamped, auto-scrolling log with 🔵 Info, ✅ Success, ❌ Error, and 🛑 Stop messages.
Exporting Results
Excel Export
- Professional formatting: dark blue headers, alternating row shading, auto-sized columns
- Color-coded status (green = success, red = failure)
- Sheet modes: Single Sheet, Sheet Per Group, Sheet Per Server, Sheet Per Database
- Every file includes an Execution Summary sheet
CSV Export
UTF-8 CSV with proper escaping. Data rows followed by an Execution Summary section.
Practical Workflows
Quick Ad-Hoc Query Across All Servers
- Check all server groups → Load Databases → Select User databases
- Type query in Script Editor
- Set Execution Mode to Parallel
- Execute → Export to Excel (Single Sheet)
Run Migration Scripts in Order
- Create folder with sequentially named scripts (
001_AddColumn.sql,002_UpdateData.sql) - Script Folder tab → Browse → Select scripts
- Set Sequential mode + Stop on Error
- Execute
Security Compliance Check
- Place compliance scripts in a folder
- Select all servers and databases
- Run with Sequential + Continue on Error
- Export to Excel for review
Data Storage & Security
| Item | Details |
|---|---|
| Configuration file | %LOCALAPPDATA%\DBLenseScriptRunner\servergroups.json |
| Password encryption | Windows DPAPI (CurrentUser scope) |
| Auto-save | Every group/server change saved automatically |
| No telemetry | No data sent externally. All operations are local. |
System Requirements
| Component | Requirement |
|---|---|
| OS | Windows 10/11 or Windows Server 2016+ |
| Runtime | .NET 8.0 (or self-contained package) |
| SQL Server | SQL Server 2016+ |
| Azure | Azure SQL Database, Azure SQL Managed Instance |
| Installation | None — single portable .exe |