Unable to add Virtual machines to the catalog using Studio, with error - 'System.OutOfMemoryException'

Unable to add Virtual machines to the catalog using Studio, with error - 'System.OutOfMemoryException'

book

Article ID: CTX270558

calendar_today

Updated On:

Description

Please consider below scenario:

  • You are adding the Virtual machines to a Machine catalog from Citrix Studio.
  • While adding the Machines, the wizard fails with below error:
Exception : System.InvalidOperationException: The connection could not be created as not all details could be validated.  The actual failure was noted with message 'Exception of type 'System.OutOfMemoryException' was thrown.'.                                                                                    PositionMessage : 
+ CategoryInfo : NotSpecified: (:) [New-Item], InvalidOperationException                                       

+ FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.PowerShell.Commands.NewItemCommand 

Environment

The above mentioned sample code is provided to you as is with no representations, warranties or conditions of any kind. You may use, modify and distribute it at your own risk. CITRIX DISCLAIMS ALL WARRANTIES WHATSOEVER, EXPRESS, IMPLIED, WRITTEN, ORAL OR STATUTORY, INCLUDING WITHOUT LIMITATION WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NONINFRINGEMENT. Without limiting the generality of the foregoing, you acknowledge and agree that (a) the sample code may exhibit errors, design flaws or other problems, possibly resulting in loss of data or damage to property; (b) it may not be possible to make the sample code fully functional; and (c) Citrix may, without notice or liability to you, cease to make available the current version and/or any future versions of the sample code. In no event should the code be used to support ultra-hazardous activities, including but not limited to life support or blasting activities. NEITHER CITRIX NOR ITS AFFILIATES OR AGENTS WILL BE LIABLE, UNDER BREACH OF CONTRACT OR ANY OTHER THEORY OF LIABILITY, FOR ANY DAMAGES WHATSOEVER ARISING FROM USE OF THE SAMPLE CODE, INCLUDING WITHOUT LIMITATION DIRECT, SPECIAL, INCIDENTAL, PUNITIVE, CONSEQUENTIAL OR OTHER DAMAGES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Although the copyright in the code belongs to Citrix, any distribution of the sample code should include only your own standard copyright attribution, and not that of Citrix. You agree to indemnify and defend Citrix against any and all claims arising from your use, modification or distribution of the sample code.

Resolution

To resolve this issue, please increase the value of "MaxMemoryPerShellMB". To do this, please run the below commandlet:

PS C:\WINDOWS\system32> cd wsman:
PS WSMan:\> cd .\localhost\Shell\
Set-Item .\MaxMemoryPerShellMB 2048

Above commandlet increases the Value of the above mentioned parameter to 2GB. Please configure the value as per your need.

Problem Cause

Citrix Studio uses PowerShell commandlets to do this operation. This issue is seen when the PowerShell is running out of Memory while executing the Commandlets specified by Citrix Studio.

To check the current memory allocated to PowerShell, please run the below commandlet as administrator:
 

PS C:\WINDOWS\system32> cd wsman:
PS WSMan:\> cd .\localhost\Shell\
PS WSMan:\localhost\Shell> dir

The default output should look like below:

Type            Name                           SourceOfValue   Value
----            ----                           -------------   -----
System.String   AllowRemoteShellAccess                         true
System.String   IdleTimeout                                    7200000
System.String   MaxConcurrentUsers                             2147483647
System.String   MaxShellRunTime                                2147483647
System.String   MaxProcessesPerShell                           2147483647

System.String   MaxMemoryPerShellMB                            2147483647
System.String   MaxShellsPerUser                               2147483647

 

This issue is seen if the above highlighted Value is set too low and is insufficient.