Import-sqmServerConfiguration
SQL ConfigurationsqmSQLTool v1.9.88+ · Import🔓 sysadmin (ALTER SETTINGS)
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
| Parameter | Type | Required | Default | Notes |
|---|---|---|---|---|
| -SqlInstance | string | Required | , | Target instance the snapshot is applied to. |
| -SqlCredential | PSCredential | Optional | , | SQL or Windows credential. Without it: Windows authentication. |
| -InputPath | string | Required | , | Path to the JSON file produced by Export-sqmServerConfiguration. Validated to exist. |
| -IncludeCategory | string[] | Optional | SpConfigure, InstanceProperties, TempDb, Services | Restrict which categories are applied. Valid values are exactly those four - everything that is actually restorable. |
| -ContinueOnError | switch | Switch | $false | Continue with the next item/category if one fails instead of aborting the whole run. |
| -EnableException | switch | Switch | $false | Throw exceptions immediately. Overrides -ContinueOnError. |
| -WhatIf / -Confirm | switch | Switch | ConfirmImpact = Medium | Show or confirm what would be applied before anything changes. |
Execution Flow
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