Export-AXModelStore out of memory error

We’re attempting to export a modelstore from the dev to the test system and receiving little success. Whenever we try to export the modelstore we get System.OutOfMemoryException in powershell. We’re running the command on a user with admin rights on both the local machine and the server but running the command remotely specifying the server and database rather than running the command directly on the AOS.

Has anyone encountered this problem?

Hi,

but have you actually checked if you DO run out of the memory on one of the servers? I bet that the problem might be in DB server (I have had a similar issue once). You might be running out of free disk space for either the log or the TEMP database. Check what’s happening with disk and RAM on DB server as you try the export once again.

Janis

I have a power shell script that exports our modelstore based on Dynamics AX Build Scripts.
I recently did the CU5 update, and now I’m receiving this error (System.OutOfMemoryException).
It generates an incomplete ax modelstore file.

I looked into Janis Cehovs’ suggestion, and checked the SQL server.
I don’t see any errors in the event logs of either server.

The odd thing is that the Export-AXModelStore command executes successfully when run from the Microsoft Dynamics AX 2012 Management Shell, but not when I execute my script from the standard cmd command prompt.

Currently my power shell script (.ps1), imports the AX libraries with the command:

  • Import-Module “C:\Program Files\Microsoft Dynamics AX\60\ManagementUtilities\Microsoft.Dynamics.ManagementUtilities.ps1”
  • Importing AxUtilLib
  • Importing AxUtilLib.PowerShell
  • Importing Microsoft.Dynamics.Administration
  • Importing Microsoft.Dynamics.AX.Framework.Management

I’m going to reboot the server tonight and see if that makes a difference. I don’t think it’s been restarted since the CU5 update.

Just wanted to see how you got past this problem…?

I’ve resolved my issue. The problem for me was in my scheduled task’s Action properties.

(Not working)
Program: C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe
Arguments: -executionpolicy unrestricted -Command “C:…\NightlyBuild.ps1 -axConfigFile \server\AX-Config.axc; exit $LASTEXITCODE”

(works correctly)
Program: Powershell.exe
Arguments: -ExecutionPolicy Bypass C:…\NightlyBuild.ps1 -axConfigFile \server\AX-Config.axc

I realize this is a bit odd, but hopefully helps a few people out.