Repair-sqmSsasSerializeError
Cluster & Services
sqmSQLTool v1.9.126+ · Repair
✓ -WhatIf supported · Medium Impact
<Create>/<Alter> script to SQL Server Analysis Services can fail with Internal error: An unexpected error occurred (file 'pcserialize.cpp', line 1535, function 'ASDatabase::Serialize'), most often reported on instances that sit inside an Always On Availability Group. The message itself gives no clue what is wrong.
The confirmed cause and fix: an undocumented
<Gen2ServerKey> element in msmdsrv.ini (see Microsoft Q&A 1350375). Its purpose is unclear and no side effects have been reported from removing it — doing so and restarting the service makes the serialization error disappear. This function locates msmdsrv.ini, backs it up, removes the element if present, and optionally restarts the service.Parameters
| Parameter | Type | Required | Default | Notes |
|---|---|---|---|---|
| -InstanceName | string | Optional | MSSQLSERVER | SSAS instance name. A "Server\Instance" prefix (as copied from SSMS) is accepted and the server part is ignored. |
| -RestartService | switch | Switch | $false | Restart the SSAS service so the fix takes effect immediately. Without it, the change is written but the serialization error keeps occurring until the next manual restart. |
| -EnableException | switch | Switch | $false | Throw immediately instead of logging the error and returning it in the result. |
Execution Flow
Output object
| Field | Contents |
|---|---|
InstanceName / ServiceName / IniPath | Which instance, its Windows service name, and the config file that was read/changed. |
BackupPath | Path of the msmdsrv.ini backup — only set when a change was actually written. |
ServiceRestarted | Whether the SSAS service was restarted. |
Status | NotPresent, Removed, WhatIf, or Error. |
Message | Detail message. |
Examples
Fix the default instance and apply it immediately
Repair-sqmSsasSerializeError -RestartService
Check a named instance without changing anything
Repair-sqmSsasSerializeError -InstanceName "SSAS2019" -WhatIf
Write the fix now, restart the service on the next maintenance window
Repair-sqmSsasSerializeError -InstanceName "SSAS2019"
Requirements
Requires local administrator rights on the SSAS server. Idempotent: a second run against an already-fixed instance reports NotPresent instead of re-touching msmdsrv.ini. Background: Microsoft Q&A 1350375.
See also
Get-sqmSsasDeploymentMode / Set-sqmSsasDeploymentMode, same msmdsrv.ini discovery for the SSAS server mode. Test-sqmSsasDirectoryPermissions, for a different class of SSAS setup problem (NTFS permissions).