Thor Logo dbatools

Get-DbaRegistryRoot

View Source
Chrissy LeMaire (@cl), netnerds.net
Windows, Linux, macOS

Synopsis

Discovers Windows registry root paths for SQL Server instances to enable direct registry configuration access

Description

Queries SQL Server WMI to locate the exact Windows registry hive path where each SQL Server instance stores its configuration settings. This eliminates the guesswork when you need to manually edit registry keys for troubleshooting startup issues, modifying trace flags, or automating configuration changes that aren’t exposed through T-SQL or SQL Server Configuration Manager. The function handles both standalone instances and failover cluster instances, returning PowerShell-ready registry paths you can immediately use with Get-ItemProperty or Set-ItemProperty commands.

Syntax

Get-DbaRegistryRoot
    [[-ComputerName] <DbaInstanceParameter[]>]
    [[-Credential] <PSCredential>]
    [-EnableException]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Get-DbaRegistryRoot

Gets the registry root for all instances on localhost

Example: 2
PS C:\> Get-DbaRegistryRoot -ComputerName server1

Gets the registry root for all instances on server1

Optional Parameters

-ComputerName

Specifies the target computer where SQL Server instances are installed. Accepts computer names, IP addresses, or SQL Server instance names which will be parsed to extract the computer name.
Use this when you need registry root paths for SQL Server instances on remote servers for configuration troubleshooting or automated registry modifications.

PropertyValue
Alias
RequiredFalse
Pipelinetrue (ByValue)
Default Value$env:COMPUTERNAME
-Credential

Allows you to login to $ComputerName using alternative Windows credentials

PropertyValue
Alias
RequiredFalse
Pipelinefalse
Default Value
-EnableException

By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with “sea of red” exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this “nice by default” feature off and enables you to catch exceptions with your own try/catch.

PropertyValue
Alias
RequiredFalse
Pipelinefalse
Default ValueFalse