Execution Flow
The function is idempotent — on repeated calls only directories that are still missing
FullControl get an ACL change; everything already correct is reported as OK and left untouched. If -ServiceAccount is omitted, the account is read from the running Windows service (MSSQLServerOLAPService for the default instance, MSOLAP$<InstanceName> for named instances), so the SSAS service must be registered (it does not need to be running).Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| -InstanceName | String | Optional | Name of the SSAS instance. Default: MSSQLSERVER (default instance). For named instances, e.g. SSAS2019. |
| -ServiceAccount | String | Optional | Name of the service account (e.g. NT SERVICE\MSSQLServerOLAPService). If omitted, it is auto-determined from the Windows service. |
| -WhatIf | Switch | Optional | Shows which permission changes would be made without executing them. |
| -Confirm | Switch | Optional | Prompts for confirmation before each ACL change. |
| -EnableException | Switch | Optional | Throws a terminating exception immediately on error instead of just logging it. |
| -ContinueOnError | Switch | Optional | Continues checking the remaining directories even if one directory fails or is missing. |
Return Value
Returns a PSCustomObject[] — one entry per checked directory (Data, Log, Temp, Backup) — with: InstanceName, Directory, Path, Status (OK, Fixed, Missing, NotFound, Failed, WhatIf, or Error), Message.
Examples
Example 1 — Check and fix the default instance
Test-sqmSsasDirectoryPermissionsExample 2 — Preview changes for a named instance
Test-sqmSsasDirectoryPermissions -InstanceName "SSAS2019" -WhatIfExample 3 — Use an explicit service account
Test-sqmSsasDirectoryPermissions -ServiceAccount "CONTOSO\svc_ssas" -ContinueOnErrorExample 4 — Show only directories that were fixed
Test-sqmSsasDirectoryPermissions | Where-Object Status -eq 'Fixed'