---
title: "Microsoft SQL Server Options for Nodinite: Supported Versions, Editions, and Best Practices"
description: Discover all Microsoft SQL Server options for Nodinite, including supported versions, editions, prerequisites, security, performance, and best practices for monitoring and logging.
---

# About using Microsoft SQL Server with Nodinite

Unlock the full potential of <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> by choosing the right Microsoft SQL Server configuration. This guide is packed with actionable tips, technical best practices, and expert advice for both first-time users and seasoned technicians:

* ✅ Full compatibility matrix for all supported SQL Server versions and editions  
* ✅ SQL Server 2025 Express now supports up to 50 GB per [Log Database][Log Databases], making it a strong low-cost option  
* ✅ Step-by-step prerequisites for seamless installation and upgrades  
* ✅ Advanced performance tuning, backup, and security strategies  
* ✅ High availability, clustering, and cloud deployment options  
* ✅ Troubleshooting guides for common SQL Server and <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> issues  
* ✅ Real-world tips: tempdb optimization, trace flags, collation, and more  
* ✅ How to leverage SQL Profiler, Always On, and SQL Agent for enterprise scenarios  

<aside aria-label="Tip" class="nodinite-note nodinite-note--tip">
<p class="nodinite-note__label" aria-hidden="true"><i class="far fa-fw fa-lightbulb"></i> Tip</p>
<div class="nodinite-note__content"><p><strong>Quick Tips:</strong></p><ul>
<li>Use -T1118 and -T834 trace flags for tempdb and memory optimizations</li>
<li>Configure multiple tempdb files (1 per core, up to 8) for best throughput</li>
<li>Always use <strong>CI_AS</strong> collation for <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> databases to avoid query issues</li>
<li>Prefer Enterprise/Standard editions for <a href="https://docs.nodinite.com/core-services/logging-service/overview/">Logging Service</a> and heavy workloads</li>
<li>Use SQL Agent or Windows Task Scheduler for automated maintenance and backups</li>
<li>Monitor SQL Server with built-in DMVs and integrate with <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> for alerting</li>
<li>Review the official <a href="https://learn.microsoft.com/en-us/sql/sql-server/?view=sql-server-ver16">SQL Server documentation</a><sup><i class="fal fa-arrow-up-right-from-square" aria-hidden="true"></i></sup> for advanced features</li>
</ul></div>
</aside>

---

## SQL Server Versions and Editions

<span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> supports a broad range of Microsoft SQL Server versions and editions, including Enterprise, Standard, Developer and Express. You should choose a version matching your organization's support policy and a edition that fits your business needs.

* [SQL Server Express](#sql-server-express) is supported.  
* SQL Server Managed Instance (Azure) is supported.  
  * Azure SQL Databases are currently **NOT** supported with <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> [Core Services][]  

|SQL Server Version|Always On support|Cluster support|Stand alone|<span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> Version|  
|---|:---:|:---:|:---:|:---:|  
|[SQL Server Managed Instance (Azure)](https://azure.microsoft.com/en-us/products/azure-sql/managed-instance)<sup><i class="fal fa-arrow-up-right-from-square" aria-hidden="true"></i></sup>||||>=6.1|  
|2025|✅|✅|✅|->7|  
|2022|✅|✅|✅|->6|  
|2019|✅|✅|✅|->6|  
|2017|✅|✅|✅|->6|  
|2016|✅|✅|✅|->6|  
|2014|❌|✅|✅|->6|  
|2012|❌|✅|✅|->6|  
|2008 R2|❌|✅⚠️|✅⚠️|->5.4 -> <6.1|  

For production [Logging][] workloads, SQL Server 2025 Express is now a viable budget-friendly option due to its 50 GB per-database limit. Older SQL Server Express versions keep the 10 GB limit and are effectively not viable for production logging in most environments.

|Feature|Enterprise|Standard|Express|  
|---|---|---|---|  
|Maximum Database Size|524 PB (theoretical limit)|524 PB (same engine)|50 GB (SQL Server 2025 Express), 10 GB (older Express versions)|  
|CPUs / Cores|OS Max ([Windows Server][] supports up to 64 sockets / 2048 logical processors)|4 sockets or 24 cores|1 socket or 4 cores|  
|Max Memory (per instance)|OS Max|128 GB (buffer pool), + other memory|1.41 GB (buffer pool only)|  
|SQL Profiler (UI)|✅|✅|❌|  

## Notes & Clarifications

### Database Size

* 524 PB (petabytes) is the technical limit due to internal architecture (32 TB per file × 16,000 files).
* In practice, your storage hardware and design will limit you before hitting that.

### CPUs/Cores

* Express: Limited to the lesser of 1 socket or 4 cores.
* Standard: Limited to the lesser of 4 sockets or 24 cores.

### Max Memory

* Express: 1.41 GB for the buffer pool (some overhead not included).
* Standard: 128 GB only for buffer pool — other components like columnstore indexes, in-memory OLTP, etc., may have their own limits.
* Enterprise: Uses as much as the OS allows.

### SQL Profiler

* Not available in SQL Server Express Edition, since it doesn’t support SQL Server Agent or other features required by some Profiler components.

## SQL Server Always On

For high availability, <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> supports SQL Server Always On. Review the [About SQL Server Always On Availability Groups][AlwaysOn] guide for detailed configuration steps and recommendations.

## SQL Server Express

SQL Server Express is supported but has important edition differences. SQL Server 2025 Express is now a compelling entry-level choice for many <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> environments because each Log Database can grow up to 50 GB. SQL Server Express 2022 and earlier keep the 10 GB limit and are effectively not suitable for production [Logging][].

If you use <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> only for [documentation][Repository Model] and [Monitoring][], both current and older Express versions may still be sufficient depending on retention volume.

<aside aria-label="Tip" class="nodinite-note nodinite-note--tip">
<p class="nodinite-note__label" aria-hidden="true"><i class="far fa-fw fa-lightbulb"></i> Tip</p>
<div class="nodinite-note__content"><ul>
<li>Start with SQL Server 2025 Express to reduce licensing cost while keeping meaningful log retention headroom (50 GB per Log Database).</li>
<li>You can still upgrade later to Standard edition if you need SQL Agent, more CPU/RAM, or higher-scale features.</li>
<li>SQL Server Express remains a strong choice for development, testing, and <a href="https://docs.nodinite.com/install-and-update/getting-started/poc/">POC</a> environments.</li>
</ul></div>
</aside>

|SQL Server Version|Always On (AOAG)|Fail Cluster|Stand alone|<span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> Version|  
|---|:---:|:---:|:---:|:---:|  
|2025|❌|❌|✅|-> 7|  
|2022|❌|❌|✅|-> 6|  
|2019|❌|❌|✅|-> 6|  
|2017|❌|❌|✅|-> 6|  
|2016|❌|❌|✅|-> 6|  
|2014|❌|❌|✅|-> 6|  
|2012|❌|❌|✅|-> 6|  
|2008 R2|❌|❌|✅|->5.4|  

<aside aria-label="Warning" class="nodinite-note nodinite-note--warning">
<p class="nodinite-note__label" aria-hidden="true"><i class="far fa-fw fa-triangle-exclamation"></i> Warning</p>
<div class="nodinite-note__content"><ol>
<li>SQL Server Express 2022 and earlier use a 10 GB per-database limit, which is effectively too small for production logging.</li>
<li>All SQL Server Express editions still lack SQL Server Agent. Use Windows <a href="https://docs.nodinite.com/logging-and-monitoring/windows-server/features/scheduled-tasks/">Scheduled Tasks</a> for maintenance jobs, such as <a href="https://docs.nodinite.com/install-and-update/troubleshooting/sql-server/automating-removal-of-old-log-databases/">removing old Log Databases</a>, or move to Standard/Enterprise when SQL Agent is required.</li>
</ol></div>
</aside>

<h2 id="sql-server-in-a-container">SQL Server in a Container</h2>

When SQL Server itself runs as a container, the host needs an Intel or AMD x86-64 processor. Microsoft supports SQL Server container images only on Linux hosts with x86-64 CPUs, and doesn't test or support emulation such as Rosetta 2, Prism, or QEMU ([SQL Server container quickstart](https://learn.microsoft.com/en-us/sql/linux/install-upgrade/quickstart-install-docker?view=sql-server-ver17&tabs=cli&pivots=cs1-bash)<sup><i class="fal fa-arrow-up-right-from-square" aria-hidden="true"></i></sup>).

| Where SQL Server runs | Host processor |
| --- | --- |
| In a container: the [Docker Sandbox][Docker Sandbox], which uses Docker Compose, or a SQL Server container you run yourself, such as a SQL Server pod in [Kubernetes][] | ✅ Intel or AMD x86-64. Docker Desktop on such a PC runs the containers in a Linux virtual machine, on Windows, macOS, and Linux alike. ❌ Not on Arm, such as an Apple silicon Mac or a Windows on Arm PC |
| Outside the containers: [SQL Server Managed Instance (Azure)](https://azure.microsoft.com/en-us/products/azure-sql/managed-instance)<sup><i class="fal fa-arrow-up-right-from-square" aria-hidden="true"></i></sup> or a SQL Server you already run | No SQL Server restriction on the host that runs the <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> containers |

The restriction is SQL Server's, not <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span>'s: <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> has run on a Raspberry Pi, an Arm computer, with Ubuntu Linux and a SQL Server Managed Instance as its back end. The Docker Sandbox, for development and test, is the only <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> package that ships SQL Server as a container; the other container platforms use a SQL Server you provide.

## <i class="fal fa-folder" aria-hidden="true"></i> Installation Path

If <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> is not installed on the same Windows Server as SQL Server, install SQL Server in any folder. For multi-server environments, review [System Parameters][], the [SqlPackageExecutable][] user guide, and the `SqlPackage.exe` path in the Nodinite Portal ([Step 3: Infrastructure][Portal SQL Server]) for configuration examples.

## Collation

<span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> requires a SQL Server instance with a collation of type `CI_AS` (**C**ase **I**nsensitive, **A**ccents **S**ensitive). Choose a collation that matches your language, policy, and business requirements.  

Learn more about SQL Server Collations in the [official documentation](https://learn.microsoft.com/en-us/sql/relational-databases/collations/collation-and-unicode-support?view=sql-server-ver16)<sup><i class="fal fa-arrow-up-right-from-square" aria-hidden="true"></i></sup>.  

## Security

<i class="fal fa-user-shield" aria-hidden="true"></i> Security is critical for your SQL Server environment. Follow these best practices:

### Account for SQL Server Instance

Run the SQL Server instance with an AD service account (not a local account) to ensure proper [SPN][] registration in Active Directory. This is required for Kerberos authentication and secure delegation; See [Trusted for delegation][].

<aside aria-label="Tip" class="nodinite-note nodinite-note--tip">
<p class="nodinite-note__label" aria-hidden="true"><i class="far fa-fw fa-lightbulb"></i> Tip</p>
<div class="nodinite-note__content"><p>Use a <a href="https://docs.nodinite.com/install-and-update/troubleshooting/windows/gmsa-accounts/">gMSA account</a> for enhanced security and simplified management.</p></div>
</aside>

### Kerberos

Windows enforces Kerberos, which is essential for secure, multi-server environments. Ensure the following are properly configured:

* [SPNs][SPN]  
* [Trusted for delegation][]  
* [Firewalls][SQL Firewall]  
* Authentication and Authorization  

### <i class="fal fa-user-shield" aria-hidden="true"></i> Trusted for delegation

See the [Trusted for delegation][] user guide for details.

## SPN

When <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> uses a [Linked Server](#linked-server), the SQL Server instance(s) must have its **S**ervice **P**rincipal **N**ame ([SPN][]) properly registered. See [Account for SQL Server Instance](#account-for-sql-server-instance) for more information.

## Linked Server

Review the [Linked Servers][] section for configuration guidance.

## DTC

See the [Transactions MSDTC][MSDTC] user guide.  

<aside aria-label="Note" class="nodinite-note nodinite-note--note">
<p class="nodinite-note__label" aria-hidden="true"><i class="far fa-fw fa-note"></i> Note</p>
<div class="nodinite-note__content"><p>The type of DTC configuration depends on your SQL Server setup and organizational policies.</p></div>
</aside>

## Performance optimizations

Maximize your <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> experience by following these performance tips:

* Run <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> in dedicated SQL instances to guarantee resources and simplify troubleshooting  
  * Assign dedicated disk volumes for the [Log Databases][] using the [LogLocations][] system parameter  
* Repeat these optimizations on **ALL** SQL Server instances (including BizTalk Server databases)  
* Use -T1118 Trace flag on SQL Instances (<2016) to optimize TEMPDB  
* [Disable PAC Verification][PACVerification] if your policy allows, to reduce RPC calls and improve performance  
* Install <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> on machines with dedicated swap volumes (>2.5x physical RAM) and SQL disks with >300 MB/s R/W  
* Ensure a secure backup volume or network share with enough free space for <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> databases  
* Windows Servers hosting [Core Services][] should have at least **16GB RAM**; high-volume environments may need more  
* Use **Simple recovery mode** for [Log Databases][] with BizTalk Server to boost performance, set with the [LogDatabaseRecovery][] System Parameter (not with [Always On][AlwaysOn], which requires **FULL**)  

### SQL Server Memory Management

SQL Server is designed to aggressively cache data in the **buffer pool** (`MEMORYCLERK_SQLBUFFERPOOL`) and will consume all memory it has been allocated over time. **This is expected behavior, not a <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> issue.** By default, SQL Server has no upper memory limit and will grow until the OS is starved — this must be explicitly capped.

#### Is high memory usage expected?

Yes. SQL Server caches database pages in the buffer pool to avoid repeated disk reads, which is normal and desirable. A dedicated SQL Server instance will eventually consume most available RAM. This is the expected behavior for **any** SQL Server workload. <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span>'s [Log Databases][] in particular grow over time and are read frequently across the Logging Service, [Web API][], and client queries — all of which contribute to buffer pool growth.

The key health indicator is **Page Life Expectancy (PLE)**: the number of seconds a data page stays in the buffer pool before being evicted. A high PLE (>300 for every 4 GB of buffer pool) indicates the cache is healthy and **not** under memory pressure. A low or falling PLE indicates SQL Server needs more RAM or the memory cap is set too low.

<aside aria-label="Tip" class="nodinite-note nodinite-note--tip">
<p class="nodinite-note__label" aria-hidden="true"><i class="far fa-fw fa-lightbulb"></i> Tip</p>
<div class="nodinite-note__content"><p>Check the Memory Consumption report in SQL Server Management Studio (SSMS): <strong>Reports → Standard Reports → Memory Consumption</strong>. A PLE in the thousands means memory is working well. The <a href="https://learn.microsoft.com/en-us/sql/relational-databases/performance-monitor/monitor-memory-usage">official Microsoft guidance</a><sup><i class="fal fa-arrow-up-right-from-square" aria-hidden="true"></i></sup> recommends a baseline PLE threshold of <code>300 × (buffer pool GB / 4)</code>.</p></div>
</aside>

#### Configure `max server memory`

You **must** configure `max server memory` to prevent SQL Server from starving the operating system and other services. Even on a dedicated SQL instance, the OS, <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> services, and Windows processes need memory headroom.

Recommended formula for a dedicated SQL Server host:

```
max server memory (MB) = Total RAM (MB) − OS headroom (2048–4096 MB) − other services
```

Examples for servers running only SQL Server:

| Total RAM | Recommended `max server memory` |
|---|---|
| 16 GB | 12 288 MB |
| 32 GB | 28 672 MB |
| 64 GB | 59 392 MB |
| 128 GB | 122 880 MB |

Apply the setting in SSMS (**Server Properties → Memory → Maximum server memory**) or via T-SQL:

```sql
-- Cap SQL Server memory (example: 28 GB on a 32 GB server)
EXEC sp_configure 'show advanced options', 1;
RECONFIGURE;
EXEC sp_configure 'max server memory (MB)', 28672;
RECONFIGURE;
```

*Always test after changing memory settings and monitor PLE for at least 24 hours.*

<aside aria-label="Note" class="nodinite-note nodinite-note--note">
<p class="nodinite-note__label" aria-hidden="true"><i class="far fa-fw fa-note"></i> Note</p>
<div class="nodinite-note__content"><p>On a <strong>dedicated</strong> SQL Server instance (as recommended for <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span>), you only need to reserve ~2–4 GB for the OS. <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> <a href="https://docs.nodinite.com/core-services/overview/">Core Services</a> run on a <strong>separate</strong> application server, so their RAM is not relevant here.</p></div>
</aside>

<aside aria-label="Warning" class="nodinite-note nodinite-note--warning">
<p class="nodinite-note__label" aria-hidden="true"><i class="far fa-fw fa-triangle-exclamation"></i> Warning</p>
<div class="nodinite-note__content"><p>Setting <code>max server memory</code> too low will cause SQL Server to page excessively, dramatically reducing performance. Never set it below 4 GB for a production <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> environment.</p></div>
</aside>

See the official Microsoft documentation for further guidance:

* [Server memory configuration options](https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/server-memory-server-configuration-options)<sup><i class="fal fa-arrow-up-right-from-square" aria-hidden="true"></i></sup>
* [Monitor and tune for memory usage](https://learn.microsoft.com/en-us/sql/relational-databases/performance-monitor/monitor-memory-usage)<sup><i class="fal fa-arrow-up-right-from-square" aria-hidden="true"></i></sup>
* [Memory management architecture guide](https://learn.microsoft.com/en-us/sql/relational-databases/memory-management-architecture-guide)<sup><i class="fal fa-arrow-up-right-from-square" aria-hidden="true"></i></sup>

### TempDB optimization

* For each core (up to 8), create 1 tempdb file of at least 128 MB (no auto growth)  
  >For example, with 14 cores, use 8 tempdb files. Placing tempdb files on different volumes can further improve performance.

## Backups

<span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> databases are critical for your monitoring and logging operations. Follow these best practices to ensure data integrity and availability:

* **DO NOT LOSE ANY DATA OR CONFIGURATION!**  
  <aside aria-label="Important" class="nodinite-note nodinite-note--important">
  <p class="nodinite-note__label" aria-hidden="true"><i class="far fa-fw fa-message-exclamation"></i> Important</p>
  <div class="nodinite-note__content"><p>Back up all your <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> databases, and make sure the documentation for the restore operation is available to the appropriate stakeholders</p></div>
  </aside>

## Trust Server Certificate

Windows Server and SQL Server should be properly configured for TLS. Review the [official documentation](https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/configure-sql-server-encryption)<sup><i class="fal fa-arrow-up-right-from-square" aria-hidden="true"></i></sup> for details.

<span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> components use **Microsoft.Data.SqlClient** (or older System.Data.SqlClient) for connection strings with modern TLS defaults (`Encrypt=True`, `TrustServerCertificate=False`). When using self-signed certificates or internal CAs, you may need to add `TrustServerCertificate=True`.

<aside aria-label="Tip" class="nodinite-note nodinite-note--tip">
<p class="nodinite-note__label" aria-hidden="true"><i class="far fa-fw fa-lightbulb"></i> Tip</p>
<div class="nodinite-note__content"><p><strong>Need comprehensive connection string guidance?</strong> See <a href="https://docs.nodinite.com/install-and-update/troubleshooting/sql-server/connection-strings/">SQL Server Connection Strings</a> for:</p><ul>
<li>Certificate validation decision guide (5 scenarios)</li>
<li>Encryption and authentication settings</li>
<li>Always On Availability Groups (AOAG) configuration</li>
<li>Troubleshooting common errors</li>
<li>Security best practices</li>
</ul></div>
</aside>

With <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> (default settings) you are using the native SQL Client (typically using the newer Microsoft.Data.SqlClient or the older System.Data.SqlClient library). You can opt to use  OLE DB Driver for SQL Server (MSOLEDBSQL). Both support the `TrustServerCertificate` parameter.

### OLE DB Driver for SQL Server (MSOLEDBSQL)

You can download the latest OLE DB Driver for SQL Server from here: [Download Microsoft OLE DB Driver for SQL Server](https://learn.microsoft.com/en-us/sql/connect/oledb/download-oledb-driver-for-sql-server)<sup><i class="fal fa-arrow-up-right-from-square" aria-hidden="true"></i></sup>.

Below is an example using version 19 of the OLE DB Driver for SQL Server. Adjust the version number as needed.

```cmd
Provider=MSOLEDBSQL.19;Data Source=NODINITE01;Initial Catalog=Nodinite_MonitoringAgent_BizTalk;Integrated Security=True;TrustServerCertificate=True
```

There may be new registry keys to enforce the policy in use to connect to SQL Server. You can use the following PowerShell scripts to [read](#read-settings-from-the-registry) and [write](#write-settings-to-the-registry) the required registry keys.

|Flag|Meaning|Values|  
|---|---|---|  
|Flag1|Protocol Encryption|0 = Optional<br>1 = Mandatory<br>2 = Strict|  
|Flag2|Trust Server Certificate|0 = Validate Cert<br>1 = Trust without validation|  

* <i class="fal fa-question" aria-hidden="true"></i> Are there equivalent registry keys for the native SqlClient?
* No, not directly. The .NET SQL client does not rely on registry-based configuration like the OLE DB driver does. Instead, it is entirely driven by the connection string and programmatic configuration.

### Read Settings from the Registry

>This script reads the current settings for the OLE DB Driver from the registry.

```powershell
# Read-OLEDB-Encryption.ps1

$registryPaths = @(
    "HKLM:\SOFTWARE\Microsoft\MSSQLServer\Client",
    "HKLM:\SOFTWARE\WOW6432Node\Microsoft\MSSQLServer\Client"
)

Write-Host "`n--- Reading OLE DB Driver Encryption and Certificate Validation Settings ---`n"

foreach ($basePath in $registryPaths) {
    $sniKeys = Get-ChildItem -Path $basePath -Name | Where-Object { $_ -like "SNI*.0" }

    foreach ($sniKey in $sniKeys) {
        $fullKeyPath = Join-Path $basePath $sniKey
        $flagPath = Join-Path $fullKeyPath "GeneralFlags"

        Write-Host "`n[$flagPath]"

        foreach ($flag in 1,2) {
            $valueName = "Flag$flag"

            if (Test-Path $flagPath) {
                try {
                    $value = Get-ItemPropertyValue -Path $flagPath -Name $valueName -ErrorAction Stop
                    Write-Host "$valueName = $value"
                } catch {
                    Write-Warning "$valueName is missing."
                }
            } else {
                Write-Warning "$flagPath does not exist."
                break
            }
        }
    }
}
```

*Script to read the current settings from the registry and display them in the console.*

### Write Settings to the Registry

>This script sets the desired values for the OLE DB Driver in the registry. You can specify the values for `EncryptionMode` and `TrustServerCertificate` as parameters.

Save the script below as `Set-OLEDB-Encryption.ps1`. Then, run it in an elevated PowerShell session to set the desired values.

```powershell
.\Set-OLEDB-Encryption.ps1 -EncryptionMode 0 -TrustServerCertificate 1
```

*Example command to set `EncryptionMode` to `0` (Optional) and `TrustServerCertificate` to `1` (Trust without validation).*

```powershell
# Set-OLEDB-Encryption.ps1

param (
    [ValidateSet(0,1,2)]
    [int]$EncryptionMode,

    [ValidateSet(0,1)]
    [int]$TrustServerCertificate
)

$registryPaths = @(
    "HKLM:\SOFTWARE\Microsoft\MSSQLServer\Client",
    "HKLM:\SOFTWARE\WOW6432Node\Microsoft\MSSQLServer\Client"
)

Write-Host "`n--- Setting OLE DB Driver Registry Values ---`n"

foreach ($basePath in $registryPaths) {
    $sniKeys = Get-ChildItem -Path $basePath -Name | Where-Object { $_ -like "SNI*.0" }

    foreach ($sniKey in $sniKeys) {
        $fullKeyPath = Join-Path $basePath $sniKey
        $flagPath = Join-Path $fullKeyPath "GeneralFlags"

        if (-not (Test-Path $flagPath)) {
            Write-Host "Creating missing path: $flagPath"
            New-Item -Path $flagPath -Force | Out-Null
        }

        if ($PSBoundParameters.ContainsKey("EncryptionMode")) {
            try {
                Set-ItemProperty -Path $flagPath -Name "Flag1" -Value $EncryptionMode -Force
                Write-Host "Set ${flagPath}\Flag1 to $EncryptionMode"
            } catch {
                Write-Error "Failed to set ${flagPath}\Flag1: $_"
            }
        }

        if ($PSBoundParameters.ContainsKey("TrustServerCertificate")) {
            try {
                Set-ItemProperty -Path $flagPath -Name "Flag2" -Value $TrustServerCertificate -Force
                Write-Host "Set ${flagPath}\Flag2 to $TrustServerCertificate"
            } catch {
                Write-Error "Failed to set ${flagPath}\Flag2: $_"
            }
        }
    }
}
```

*Script to set the desired values in the registry for the OLE DB Driver.*

---

## <i class="fal fa-hand-point-right" aria-hidden="true"></i> Next Steps

* <i class="fal fa-database" aria-hidden="true"></i> [Log Databases][]  
* <i class="fal fa-hard-drive" aria-hidden="true"></i> [Logging Service][]  
* <i class="fal fa-plug" aria-hidden="true"></i> [SQL Server Connection Strings][SQL Connection Strings]  
* <i class="fal fa-shield-check" aria-hidden="true"></i> [SQL Server Firewall Configuration][SQL Firewall]  
* <i class="fal fa-user-shield" aria-hidden="true"></i> [SQL Server Sysadmin Requirements][]  

## <i class="fal fa-link-horizontal" aria-hidden="true"></i> Related Topics

* <i class="fal fa-database" aria-hidden="true"></i> [SQL Server Troubleshooting][SQL Server Overview]  
* <i class="fal fa-server" aria-hidden="true"></i> [Always On Availability Groups][AlwaysOn]  
* <i class="fal fa-server" aria-hidden="true"></i> [Core Services][]  
* <i class="fal fa-database" aria-hidden="true"></i> [Configuration Database Prerequisites][]  
* <i class="fal fa-database" aria-hidden="true"></i> [Log Database Prerequisites][]  
* <i class="fal fa-id-card" aria-hidden="true"></i> [gMSA accounts][]  
* <i class="fal fa-link" aria-hidden="true"></i> [Linked Servers][]  
* <i class="fal fa-arrows-rotate" aria-hidden="true"></i> [MSDTC][]  
* <i class="fal fa-sitemap" aria-hidden="true"></i> [Repository Model][]  
* <i class="fal fa-key" aria-hidden="true"></i> [SPN][]  
* <i class="fal fa-sliders" aria-hidden="true"></i> [System Parameters][]  
* <i class="fal fa-user-shield" aria-hidden="true"></i> [Trusted for delegation][]  
* <i class="fal fa-trash" aria-hidden="true"></i> [Automating removal of old Log Databases][AutoRemove]  
* <i class="fal fa-forward-step" aria-hidden="true"></i> [Step 3: Infrastructure][Portal SQL Server]  

[AlwaysOn]:https://docs.nodinite.com/install-and-update/troubleshooting/sql-server/always-on-availability-groups/
[AutoRemove]:https://docs.nodinite.com/install-and-update/troubleshooting/sql-server/automating-removal-of-old-log-databases/
[Configuration Database Prerequisites]:https://docs.nodinite.com/core-services/configuration-database/getting-started/prerequisites/
[Core Services]:https://docs.nodinite.com/core-services/overview/
[Docker Sandbox]:https://docs.nodinite.com/install-and-update/troubleshooting/docker/overview/
[gMSA accounts]:https://docs.nodinite.com/install-and-update/troubleshooting/windows/gmsa-accounts/
[Kubernetes]:https://docs.nodinite.com/install-and-update/troubleshooting/kubernetes/overview/
[Linked Servers]:https://docs.nodinite.com/install-and-update/troubleshooting/sql-server/linked-servers/
[Log Database Prerequisites]:https://docs.nodinite.com/core-services/log-databases/getting-started/prerequisites/
[Log Databases]:https://docs.nodinite.com/core-services/log-databases/overview/
[LogDatabaseRecovery]:https://docs.nodinite.com/administration/settings/system-parameters/logdatabaserecovery/
[Logging]:https://docs.nodinite.com/logging/
[Logging Service]:https://docs.nodinite.com/core-services/logging-service/overview/
[LogLocations]:https://docs.nodinite.com/administration/settings/system-parameters/loglocations/
[Monitoring]:https://docs.nodinite.com/monitoring/
[MSDTC]:https://docs.nodinite.com/install-and-update/troubleshooting/windows/transactions-msdtc/
[PACVerification]:https://docs.nodinite.com/install-and-update/troubleshooting/windows/pacverification/
[POC]:https://docs.nodinite.com/install-and-update/getting-started/poc/
[Portal SQL Server]:https://docs.nodinite.com/install-and-update/getting-started/version-7/install-nodinite-v7-steps/03-infrastructure/#configure-sql-server-connectivity
[Repository Model]:https://docs.nodinite.com/repository-model/overview/
[Scheduled Tasks]:https://docs.nodinite.com/logging-and-monitoring/windows-server/features/scheduled-tasks/
[SPN]:https://docs.nodinite.com/install-and-update/troubleshooting/sql-server/spn/
[SQL Connection Strings]:https://docs.nodinite.com/install-and-update/troubleshooting/sql-server/connection-strings/
[SQL Firewall]:https://docs.nodinite.com/install-and-update/troubleshooting/sql-server/firewall/
[SQL Server Overview]:https://docs.nodinite.com/install-and-update/troubleshooting/sql-server/overview/
[SQL Server Sysadmin Requirements]:https://docs.nodinite.com/install-and-update/troubleshooting/sql-server/sql-server-sysadmin-requirements/
[SqlPackageExecutable]:https://docs.nodinite.com/administration/settings/system-parameters/sqlpackageexecutable/
[System Parameters]:https://docs.nodinite.com/administration/settings/system-parameters/overview/
[Trusted for delegation]:https://docs.nodinite.com/install-and-update/troubleshooting/windows/trusted-for-delegation/
[Web API]:https://docs.nodinite.com/core-services/web-api/overview/
[Windows Server]:https://docs.nodinite.com/logging-and-monitoring/windows-server/features/windows-server/