Author | Chrissy LeMaire (@cl), netnerds.net |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Import-DbaSpConfigure on GitHub.
Want to see the Bill Of Health for this command? Check out Import-DbaSpConfigure.
Copies sp_configure settings between SQL Server instances or applies settings from a SQL file.
Copies all sp_configure settings from a source SQL Server instance to a destination instance, or applies sp_configure settings from a SQL file to an instance. This function handles advanced options visibility, validates server versions for compatibility, and executes the necessary RECONFIGURE statements. Essential for maintaining consistent configuration across environments during migrations, standardization projects, or when applying saved configuration templates.
Import-DbaSpConfigure
[-Force]
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Import-DbaSpConfigure
[-Source <DbaInstanceParameter>]
[-Destination <DbaInstanceParameter>]
[-SourceSqlCredential <PSCredential>]
[-DestinationSqlCredential <PSCredential>]
[-Force]
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Import-DbaSpConfigure
[-SqlInstance <DbaInstanceParameter>]
[-Path <String>]
[-SqlCredential <PSCredential>]
[-Force]
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
PS C:\> Import-DbaSpConfigure -Source sqlserver -Destination sqlcluster
Imports the sp_configure settings from the source server sqlserver and sets them on the sqlcluster server using Windows Authentication
PS C:\> Import-DbaSpConfigure -Source sqlserver -Destination sqlcluster -Force
Imports the sp_configure settings from the source server sqlserver and sets them on the sqlcluster server using Windows Authentication. Will not do a version check between Source and Destination
PS C:\> Import-DbaSpConfigure -Source sqlserver -Destination sqlcluster -SourceSqlCredential $SourceSqlCredential -DestinationSqlCredential $DestinationSqlCredential
Imports the sp_configure settings from the source server sqlserver and sets them on the sqlcluster server using the SQL credentials stored in the variables $SourceSqlCredential and
$DestinationSqlCredential
PS C:\> Import-DbaSpConfigure -SqlInstance sqlserver -Path .\spconfig.sql -SqlCredential $SqlCredential
Imports the sp_configure settings from the file .\spconfig.sql and sets them on the sqlserver server using the SQL credential stored in the variable $SqlCredential
Source SQL Server instance to copy sp_configure settings from. Requires sysadmin privileges to read configuration values.
Use this when migrating settings between servers or standardizing configurations across your environment.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Target SQL Server instance where sp_configure settings will be applied. Requires sysadmin privileges to modify configuration.
This server will have its configuration updated to match the source server's settings.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Credentials for connecting to the source SQL Server instance. Use when Windows authentication is not available.
Accepts PowerShell credential objects created with Get-Credential.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Credentials for connecting to the destination SQL Server instance. Use when Windows authentication is not available.
Accepts PowerShell credential objects created with Get-Credential.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Specifies a SQL Server instance to set up sp_configure values on using a SQL file.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Path to a SQL script file containing sp_configure commands to execute. The file should contain individual sp_configure statements.
Use this parameter when applying saved configurations from Export-DbaSpConfigure or custom configuration scripts.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Use this SQL credential if you are setting up sp_configure values from a SQL file.
Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.
For MFA support, please use Connect-DbaInstance.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Bypasses the SQL Server version compatibility check between source and destination instances. By default, major versions must match.
Use with caution as some configuration options may not be available or may behave differently across SQL Server versions.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
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.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.
Alias | wi |
Required | False |
Pipeline | false |
Default Value |
If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.
Alias | cf |
Required | False |
Pipeline | false |
Default Value |