PowerShell Universal - 5.6.2

PowerShell Universal - 5.6.2

Release Notes

Features

Bug Fixes

Admin Console

  • Fixed locking issue with admin console
  • Fixes to the admin console code editor
  • Fixed permission issues with resources in the admin console
  • Minor fixes to several pages

Agent

  • Fixed crashing issue with agent service

APIs

  • Fixed crashing issue with API tester
  • Fixed C# API endpoint access to credentials

Apps

  • Fixed issue with duplicate pages
  • Fixed issue with $Roles variable

Automation

  • Fixed issue with environment variables and run as credentials
  • Fixed file parameters
  • Fixed dispatcher and job reporting issues
  • Fixed an issue grooming jobs

Platform

  • Added detection for git repository ownership on Windows
  • Updated to Microsoft.PowerShell.SDK 7.5.2

Downloads

Anyone else getting out of memory errors running scripts after going to 5.6.2? I was on 5.6.0. Rolling back to 5.6.0 for now.

Cant say I have had any issues as far as scripts go, updated and all my jobs are still running fine. What’s your setup? I’m running on windows as a service with SQL.

I think it might be a .net security update. Rolled back to 5.6.0 and still seeing it. Going to try to uninstall latest and see if it corrects itself.

Windows Service (msi install), local db. Dev instance. Need to check production (not much on it right now since working things out on dev.

2025-08-11 11:00:29.067 -04:00 [ERR] Job failed. Exception of type 'System.OutOfMemoryException' was thrown.    at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
   at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
   at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)
   at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
   at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
   at System.Management.Automation.PowerShell.Invoke[T]()
   at Microsoft.PowerShell.Commands.ModuleCmdletBase.GetModuleIfAvailable(ModuleSpecification requiredModule, Runspace rsToUse)
   at System.Management.Automation.Runspaces.InitialSessionState.ProcessImportModule(Runspace initializedRunspace, IEnumerable moduleList, String path, HashSet`1 publicCommands, HashSet`1 unresolvedCmdsToExpose)
   at System.Management.Automation.Runspaces.InitialSessionState.BindRunspace(Runspace initializedRunspace, PSTraceSource runspaceInitTracer)
   at System.Management.Automation.Runspaces.LocalRunspace.DoOpenHelper()
   at System.Management.Automation.Runspaces.RunspaceBase.CoreOpen(Boolean syncCall)
   at UniversalDashboard.Services.UDRunspaceFactory.CreateRunspace() in D:\a\universal\universal\src\UniversalDashboard\Services\UDRunspaceFactory.cs:line 236
   at UniversalDashboard.Services.UDRunspaceFactory.Create() in D:\a\universal\universal\src\UniversalDashboard\Services\UDRunspaceFactory.cs:line 385
   at Microsoft.Extensions.ObjectPool.DefaultObjectPool`1.Get()
   at UniversalDashboard.Services.UDRunspaceFactory.GetRunspaceReference() in D:\a\universal\universal\src\UniversalDashboard\Services\UDRunspaceFactory.cs:line 80
   at UniversalDashboard.Services.UDRunspaceFactory.<GetRunspaceAsync>d__11.MoveNext() in D:\a\universal\universal\src\UniversalDashboard\Services\UDRunspaceFactory.cs:line 59
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at UniversalAutomation.Host.JobService.<ExecuteScript>d__8.MoveNext() in D:\a\universal\universal\src\Host\JobService.cs:line 60

We had a few scripts that got ‘Exception of type ‘System.OutOfMemoryException’ was thrown.’ when we upgraded to 5.6

In our case it was always happening in scripts that used ‘New-PSDrive’. I fixed it by piping that command to ‘Out-Null’. I found this in the event log that got me pointed towards the output of that command causing the issue:
Error Message = Exception of type ‘System.OutOfMemoryException’ was thrown.
Fully Qualified Error ID = System.OutOfMemoryException,Microsoft.PowerShell.Commands.OutLineOutputCommand

1 Like

Looks like it is only happening with PowerShell 5.1, PowerShell 7+ is fine. We can work around it, and it does look like it started happening when I went to 5.6 vs 5.6.2 looking back at the job logs.

Wanted to add I’m seeing it to on 5.6.2, powershell 5.1, sql 2022, BUT only when returning a hashtable object from a script (even a basic one). If I return anything else it seems okay. Possibly weird json serialization problem?

Example
scriptexample.ps1

return @{ foo = 'bar' }

job log

Exception of type 'System.OutOfMemoryException' was thrown.
at <ScriptBlock>, C:\ProgramData\UniversalAutomation\Repository\ScriptExample.ps1: line 2
at <ScriptBlock>, <No file>: line 1
1 Like

same here

That would make sense since I am definitely returning collections in those scripts. And others without them are working fine.

Also might explain why I’m not seeing it since I only use PSCore

I can reproduce this with 5.1.

Additionally, outputting a PSCustomObject doesn’t cause this problem. Strange.

[PSCustomObject]@{ foo = "bar" }
1 Like