Commands / Invoke-sqmCollationChange
Invoke-sqmCollationChange
SQL Config sqmSQLTool v1.8.2+ · Invoke ✓ -WhatIf supported  ·  ⚠ Service restart required
Changes the server collation of a SQL Server instance. Uses 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

ParameterTypeRequiredDefaultNotes
-SqlInstancestringOptional$env:COMPUTERNAMEDefault instance or SERVER\InstanceName.
-NewCollationstringRequiredTarget collation, e.g. Latin1_General_CI_AS.
-BackupBeforeChangeswitchSwitch$falseFull backup of all system DBs before the change.
-IncludeUserDatabasesswitchSwitch$falseAfter system collation change: also ALTER DATABASE … COLLATE for each user DB.
-SqlCredentialPSCredentialOptional

Execution Flow

START -WhatIf? YES Show plan only no changes made NO -SqlInstance provided? NO → Default: $env:COMPUTERNAME Rollback documentation Save current collation + SQL Server version to log before any change -BackupBeforeChange? YES Full backup system databases NO Stop SQL Server Service Stop-Service "MSSQL$InstanceName" (or MSSQLSERVER for default) Named instance? (SERVER\InstanceName) YES add -s flag NO sqlservr.exe -m -T4022 -T3659 [-s"InstanceName"] -q"NewCollation" Minimal mode — changes system DB collation — waits until sqlservr.exe exits -T4022: skip startup SPs  ·  -T3659: log collation change errors Start SQL Server Service Normal start — all databases come online Actual collation = NewCollation? NO Rollback restart service without -q YES -IncludeUserDatabases? YES ALTER DATABASE each user DB NO DONE

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 `
    -IncludeUserDatabases
Preview only — no changes made
Invoke-sqmCollationChange -SqlInstance "SQL01" -NewCollation "Latin1_General_CI_AS" -WhatIf