i want to import a MDX result set into Powershell using Invoke-ASCmd.
Import-Module SQLPS -DisableNameChecking
Import-Module SQLASCMDLETS
Push-Location SQLSERVER:\SQLAS\$ServerInstance\Default\Databases\$Database\Cubes\
$result = Invoke-ASCmd -Database $Database -Query $Query
Pop-Location
It fails with a System.OutOfMemoryException
- The same MDX query works fine in SQL Server Management Studio.
- There is still a lot of RAM free.
- The Powershell runs in 64bit mode.
- MaxMemoryPerShellMB is increased.
- I am using SQL Server 2016 and Powershell 4
What's to do, to import large datasets from SQL Server Analysis Services using Powershell?