SQL Server setup fails with "Unable to generate a temporary class" when through chef-solo on vagrant SQL Server setup fails with "Unable to generate a temporary class" when through chef-solo on vagrant powershell powershell

SQL Server setup fails with "Unable to generate a temporary class" when through chef-solo on vagrant


I could potentially list a lot of things I did to track this down, but in the end I discovered the failure wasn't specific to running the installer through Chef, or even Ruby. Essentially it would error out any time I used another process to install SQL Server through WinRM, even PowerShell which would produce an OutOfMemoryException in the installer logs.

This ultimately led me to wonder what was different about executing the installer through WinRM. Then I had a thought. If I were Microsoft I'd probably have some enterprisey features around WinRM that limited that attack surface on a server. Apparently WinRM has a feature called Quota Management.

In short, modifying the local group policy of my Windows guest VM fixed the problem and I was finally able to successfully install SQL Server through WinRM and Chef (with my above PS script). Here are the settings I used:

Console Root | Local Computer Policy | Computer Configuration | Administrative Templates | Windows Components | Windows Remote Shell

  • MaxConcurrentUsers: 100
  • MaxMemoryPerShellMB: 0
  • MaxProcessesPerShell: 0
  • MaxShellsPerUser: 0


I also had this issue installing sql server over DSC on server 2016 (and probably older versions)

You can also set this option via powershell directly:

set-item WSMan:\localhost\Shell\MaxMemoryPerShellMB 2048


From that ticket Chef COOK-1172, Julian C. Dunn [Chef] added a comment

We believe this is now fixed by Microsoft in the following hotfix, which will restore WinRM's respecting of MaxMemoryPerShellMB: http://support.microsoft.com/kb/2842230

Unfortunately, this does not work for me. I am still having the same issue.