< Back

Import-DbaSpConfigure

Mon Jan 13, 2020 12:02 pm

NAME Import-DbaSpConfigure



SYNOPSIS

Updates sp_configure settings on destination server.





SYNTAX

Import-DbaSpConfigure [-Force <Switch>] [-EnableException <Switch>] [<CommonParameters>]



Import-DbaSpConfigure [-Source <DbaInstanceParameter>] [-Destination <DbaInstanceParameter>] [-SourceSqlCredential

<Pscredential>] [-DestinationSqlCredential <Pscredential>] [-Force <Switch>] [-EnableException <Switch>]

[<CommonParameters>]



Import-DbaSpConfigure [-SqlInstance <DbaInstanceParameter>] [-Path <String>] [-SqlCredential <Pscredential>]

[-Force <Switch>] [-EnableException <Switch>] [<CommonParameters>]





DESCRIPTION

Updates sp_configure settings on destination server.





PARAMETERS

-Destination [<DbaInstanceParameter>]

Destination SQL Server. You must have sysadmin access and the server must be SQL Server 2000 or higher.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-DestinationSqlCredential [<Pscredential>]

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.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-EnableException [<Switch>]

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.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-Force [<Switch>]

If this switch is enabled, no version check between Source and Destination is performed. By default, the major

and minor versions of Source and Destination must match when copying sp_configure settings.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-Path [<String>]

Specifies the path to a SQL script file holding sp_configure queries for each of the settings to be changed.

Export-DbaSPConfigure creates a suitable file as its output.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-Source [<DbaInstanceParameter>]

Source SQL Server. You must have sysadmin access and server version must be SQL Server version 2000 or higher.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-SourceSqlCredential [<Pscredential>]

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.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-SqlCredential [<Pscredential>]

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.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-SqlInstance [<DbaInstanceParameter>]

Specifies a SQL Server instance to set up sp_configure values on using a SQL file.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

None You cannot pipe objects to Import-DbaSpConfigure





OUTPUTS

$true if success

$false if failure





NOTES





Tags: SpConfig, Configure, Configuration

Author: Chrissy LeMaire (@cl), netnerds.net



Website: https://dbatools.io

Copyright: (c) 2018 by dbatools, licensed under MIT

License: MIT https://opensource.org/licenses/MIT



-------------------------- EXAMPLE 1 --------------------------



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

-------------------------- EXAMPLE 2 --------------------------



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

-------------------------- EXAMPLE 3 --------------------------



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

-------------------------- EXAMPLE 4 --------------------------



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



RELATED LINKS

https://dbatools.io/Import-DbaSpConfigure