Invoke-sqmCollationChange
SQL Config
sqmSQLTool v1.8.2+ · Invoke
✓ -WhatIf supported · ⚠ Service restart required
sqlservr.exe in minimal mode (-m -T4022 -T3659) to apply the new collation without a full reinstall. Handles named instances correctly (-s flag). Saves rollback documentation before making changes and verifies the result after restart. Optionally updates all user database collations as well.
Parameters
| Parameter | Type | Required | Default | Notes |
|---|---|---|---|---|
| -SqlInstance | string | Optional | $env:COMPUTERNAME | Default instance or SERVER\InstanceName. |
| -NewCollation | string | Required | , | Target collation, e.g. Latin1_General_CI_AS. |
| -BackupBeforeChange | switch | Switch | $false | Full backup of all system DBs before the change. |
| -IncludeUserDatabases | switch | Switch | $false | After system collation change: also ALTER DATABASE … COLLATE for each user DB. |
| -SqlCredential | PSCredential | Optional | , | |
| -ContinueOnError | switch | Switch | $false | Continue with the next step on error (rarely used). |
| -EnableException | switch | Switch | $false | Throw exceptions immediately. |
| -ExcludeDatabase | string[] | Optional | @() | Databases to exclude from -IncludeUserDatabases (wildcards allowed). |
| -OutputPath | string | Optional | (Get-sqmDefaultOutputPath) | Output directory for rollback documentation and column script. Default: Get-sqmDefaultOutputPath. |
| -ServiceName | string | Optional | , | Windows service name (automatically determined from SqlInstance if not specified). |
| -StartupTimeoutSeconds | int | Optional | 120 | Maximum wait time for sqlservr.exe in minimal mode (default: 120). |
Execution Flow
Examples
Change collation, default instance
Invoke-sqmCollationChange -NewCollation "Latin1_General_CI_AS"
Named instance, with backup and user DB update
Invoke-sqmCollationChange `
-SqlInstance "SQL01\SQL2017" `
-NewCollation "German_CI_AS" `
-BackupBeforeChange `
-IncludeUserDatabasesPreview only, no changes made
Invoke-sqmCollationChange -SqlInstance "SQL01" -NewCollation "Latin1_General_CI_AS" -WhatIf