4.1.0 System.OutOfMemoryException was thrown

Hi all

Thanks for taking the time to look at this.

I've used PSADT for quite a few years and this is pretty much the first time I've hit an issue I've not managed to google my way out of. Fairly sure it's something stupid I've missed though.

I have a 'Restart Prompt' Intune remediation set of scripts written for 4.0.5 and now trying to update it to 4.1.0 so we can make ServiceUI disappear (such great work whoever managed to do that!!). I have the 4.1.0 installed as a module with the AllUsers -Scope on my device for testing.

Rather than share the whole script as I have managed to narrow my error to a single command 'Show-ADTInstallationPrompt'. If I run the following from an elevated PowerShell_ISE console it runs fine but if I run it from Intune using SYSTEM service account or from an un-elevated normal Powershell_ISE console window I get the 'System.OutOfMemoryException' error (see below for full error).

Although just to add to the above it seems running any most command produces the same error, such as 'Show-ADTInstallationRestartPrompt -NoCountdown' or 'Show-ADTDialogBox'. Makes me think even more that I have done something wrong somewhere or missed something. 'Show-ADTDialogBox' seems to work without issue though.

Thanks for your time, hopefully someone can help.

Command:
Show-ADTInstallationPrompt -Message "Test" -Title 'Testing' -Subtitle 'Test' -ButtonRightText 'Dismiss'

Full Error:

Show-ADTInstallationPrompt : Exception of type 'System.OutOfMemoryException' was thrown.
At line:1 char:1
+ Show-ADTInstallationPrompt
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Show-ADTInstallationPrompt], OutOfMemoryException
    + FullyQualifiedErrorId : System.OutOfMemoryException,Show-ADTInstallationPrompt

I ran your line on my machine.

I got no error. The issue seems to be isolated to your machine.
I'd reboot and try again.

I still get the error, unfortunately rebooting hasn't changed anything.

Running from elevated ISE is fine, however when run from SYSTEM or non-elevated I get the error.

Deployed to a few other devices and one runs it fine but 2 others get the same out of memory error.

Can anyone help to troubleshoot further?

I've updated to 4.1.4 in case it was a version specific issue but i get the same error. Just trying to Initialize the module presents the same out of memory error:

PS C:\Users\myuser> Initialize-ADTModule
out-lineoutput : Exception of type 'System.OutOfMemoryException' was thrown.
At C:\Program Files\WindowsPowerShell\Modules\PSAppDeployToolkit\4.1.4\PSAppDeployToolkit.psm1:14607 char:21
+ ...             $logErrorProperties.Add($propName, [PSADT.Utilities.MiscU ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [out-lineoutput], OutOfMemoryException
    + FullyQualifiedErrorId : System.OutOfMemoryException,Microsoft.PowerShell.Commands.OutLineOutputCommand

Update to 4.1.5 please as this is addressed.

1 Like

Thanks I will try that, didn't realise there was a more recent version.

Pretty sure I identified the issue with the previous version - it was when I was setting a FluentAccentColor in the config - anything other than $null would give me the memory error.

4.1.5 fixed the issue for me :slight_smile: so thank-you very much for that - I will mark as solution shortly.

Something else but not sure if it's worthy of starting a new thread is about editing the config.psd1 file in the PSModule location.

I know it's not supported and at least in 4.1.5 it won't run if that file is edited. I'm using PSADT for displaying reboot prompts if users haven't rebooted. I use Intune remediation scripts to install the PSADT module and then base64 conversions to apply our firm's logo's in the asset folder and also configure the config.psd1 file to include our company name and change the fluent accent colour.

Is there anyway of being able to do this and re-sign the PS module so it will accept the changes and run? If not is there another way anyone can think of to achieve the same task without having to deploy a PSADT template that has my required changes?

1 Like

If you've got a PKI structure, you can resign our module if you wish to modify it. You could also sideload your config and assets into ProgramData or something, then on the Open-ADTSession line, add -ScriptDirectory C:\Path\To\FolderThatContainsAssetsAndConfigFolders.

Thank-you @mjr4077au I really appreciate your quick responses - I'll have a think but I'm very happy to at least have the process working now.

1 Like