· Uwe Janke
Commands / Import-sqmServerConfiguration

Import-sqmServerConfiguration

SQL ConfigurationsqmSQLTool v1.9.88+ · Import🔓 sysadmin (ALTER SETTINGS)
Counterpart to Export-sqmServerConfiguration. Reads the snapshot at -InputPath and re-applies whichever captured settings can actually be changed on a live, already-installed instance. Not every captured category is restorable, so the current value on -SqlInstance is always compared against the desired value first, only genuinely differing settings are touched, and every attempted item gets its own result row (Success / Skipped / Failed / WhatIf) - the same granularity Import-sqmDatabaseLogins uses for logins.

SpConfigure is the main, safe-to-restore category and the reason this function exists: every value is applied via Set-DbaSpConfigure, which enables show advanced options when needed. InstanceProperties: only BackupDirectory / DefaultFile / DefaultLog are settable (via Set-DbaDefaultPath); Edition, Collation, LoginMode, IsClustered and the rest are installation-level and are reported as Informational, never attempted. TempDb: file Size and Growth are re-applied with ALTER DATABASE tempdb MODIFY FILE, matched by LogicalName; a file is only grown (SQL Server itself rejects shrinking through MODIFY FILE) and is skipped when the snapshot values cannot be parsed. Services: only StartMode is re-applied; ServiceAccount is deliberately never touched, because the snapshot never contained a password.

Never restorable and always reported as Informational/Skipped: DatabaseMail (profiles need SMTP account data that was never captured), LinkedServers (dbatools never exports the password/login mapping) and Databases (a read-only inventory - use Import-sqmDatabaseSettings for real per-database Options restore).

Parameters

ParameterTypeRequiredDefaultNotes
-SqlInstancestringRequired, Target instance the snapshot is applied to.
-SqlCredentialPSCredentialOptional, SQL or Windows credential. Without it: Windows authentication.
-InputPathstringRequired, Path to the JSON file produced by Export-sqmServerConfiguration. Validated to exist.
-IncludeCategorystring[]OptionalSpConfigure, InstanceProperties, TempDb, ServicesRestrict which categories are applied. Valid values are exactly those four - everything that is actually restorable.
-ContinueOnErrorswitchSwitch$falseContinue with the next item/category if one fails instead of aborting the whole run.
-EnableExceptionswitchSwitch$falseThrow exceptions immediately. Overrides -ContinueOnError.
-WhatIf / -ConfirmswitchSwitchConfirmImpact = MediumShow or confirm what would be applied before anything changes.

Execution Flow

START dbatools installed? NO throw: dbatools not found YES Read the JSON snapshot at -InputPath Produced by Export-sqmServerConfiguration · -IncludeCategory selects what is attempted Category restorable on a live instance? NO Informational / Skipped row DatabaseMail (no SMTP account data) LinkedServers (no password mapping) Databases (read-only inventory) YES SpConfigure: Set-DbaSpConfigure per differing value Enables 'show advanced options' itself when required - the main restorable category InstanceProperties: Set-DbaDefaultPath Only BackupDirectory / DefaultFile / DefaultLog are settable Edition, Collation, LoginMode, IsClustered: Informational only TempDb: ALTER DATABASE tempdb MODIFY FILE Size and Growth matched by LogicalName · grows only, never shrinks A file whose snapshot values cannot be parsed is skipped Services: ChangeStartMode() StartMode only - ServiceAccount is never touched (no password in the snapshot) Return [PSCustomObject] per item SqlInstance · Category · Item · CurrentValue · DesiredValue Status: Success / Skipped / Failed / Informational / WhatIf DONE

Examples

Apply every restorable setting from the snapshot
Import-sqmServerConfiguration -SqlInstance 'SQL01' -InputPath 'C:\Backups\SQLSnapshots\SQL01_MSSQLSERVER_20260810_120000.json'
Show which sp_configure values would change, without applying anything
Import-sqmServerConfiguration -SqlInstance 'SQL01' -InputPath '.\baseline.json' -IncludeCategory SpConfigure -WhatIf
Restore only tempdb file sizes after a rebuild
Import-sqmServerConfiguration -SqlInstance 'SQL01' -InputPath '.\baseline.json' -IncludeCategory TempDb
Compare the result against the exported baseline afterwards
Import-sqmServerConfiguration -SqlInstance 'SQL01' -InputPath '.\baseline.json' -ContinueOnError |
    Where-Object Status -in 'Failed','Skipped' | Format-Table Category, Item, CurrentValue, DesiredValue