Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Powershell script to fix Adobe Photoshop CC memory issue #2416657
# Get the ID and security principal of the current user account
$myWindowsID=[System.Security.Principal.WindowsIdentity]::GetCurrent()
$myWindowsPrincipal=new-object System.Security.Principal.WindowsPrincipal($myWindowsID)
# Get the security principal for the Administrator role
$adminRole=[System.Security.Principal.WindowsBuiltInRole]::Administrator
# Check to see if we are currently running "as Administrator"
if ($myWindowsPrincipal.IsInRole($adminRole))
{
# We are running "as Administrator" - so change the title and background color to indicate this
$Host.UI.RawUI.WindowTitle = $myInvocation.MyCommand.Definition + "(Elevated)"
$Host.UI.RawUI.BackgroundColor = "DarkBlue"
clear-host
}
else
{
# We are not running "as Administrator" - so relaunch as administrator
# Create a new process object that starts PowerShell
$newProcess = new-object System.Diagnostics.ProcessStartInfo "PowerShell";
# Specify the current script path and name as a parameter
$newProcess.Arguments = $myInvocation.MyCommand.Definition;
# Indicate that the process should be elevated
$newProcess.Verb = "runas";
# Start the new process
[System.Diagnostics.Process]::Start($newProcess);
# Exit from the current, unelevated, process
# exit
}
# Running code that needs to be elevated here
# A flexible way to determine the Photoshop path is below
$registryPath = $('Registry::'+$(Get-ChildItem -Path 'Registry::HKEY_CURRENT_USER\Software\Adobe\Photoshop\' -ErrorAction Inquire | Select-String -Pattern '[\w_\\]+\d+\.\d+'))
$name = "OverridePhysicalMemoryMB"
# Determine amount of installed RAM system memory in MB from cim_physical memory
$value = (Get-WmiObject -class "cim_physicalmemory" | Measure-Object -Property Capacity -Sum).Sum/ 1024 / 1024
IF([string]::IsNullOrEmpty( $(Get-ChildItem -Path 'Registry::HKEY_CURRENT_USER\Software\Adobe\Photoshop\' -ErrorAction SilentlyContinue | Select-String -Pattern '[\w_\\]+\d+\.\d+')) -or !(Test-Path $registryPath))
{
$host.ui.WriteErrorLine("Cannot find Adobe Photoshop installation location in the system registry.`r`nTry installing or re-installing Adobe Photoshop first.") | Out-Null
}
ELSE
{
New-ItemProperty -Path $registryPath -Name $name -Value $value -PropertyType DWORD -Force -Verbose
}
Write-Host "Please press any key to continue..." | Out-Null
$Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")| Out-Null
@mavaddat

This comment has been minimized.

Copy link
Owner Author

@mavaddat mavaddat commented Mar 12, 2018

This Powershell script implements the solution described by JDH_2017 to fix Adobe Photoshop CC memory issue #2416657
The workaround involves telling Photoshop how much memory is installed in your system in a DWORD called OverridePhysicalMemoryMB at \Computer\HKEY_CURRENT_USER\Software\Adobe\Photoshop\120.0
RegEdit for Photoshop being told how much memory is installed in system under a DWORD called OverridePhysicalMemoryMB at \Computer\HKEY_CURRENT_USER\Software\Adobe\Photoshop\120.0
To run this in your PowerShell without modifying your execution policy, try the following one-liner in PowerShell terminal:

[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls";  powershell -nop -c "iex(New-Object Net.WebClient).DownloadString('https://gist.githubusercontent.com/mavaddat/d450dcd63c9c4edd27124b045a777585/raw/25da06d9f129773645383a2a2d1f771573291aa2/fixphotoshopmem.ps1')" 

Always closely examine the source code for a script before running it on your system to ensure that the script is not executing any malicious commands.

Detailed instructions

  1. Close all Adobe applications, then
  2. Launch Windows PowerShell (see "Starting Windows PowerShell"), for example Windows logo key+X, then hit "I"
    wait a moment for the PS command prompt to appear
  3. Then copy and paste the following into your PowerShell prompt and press "Enter":
[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls";  powershell -nop -c "iex(New-Object Net.WebClient).DownloadString('https://gist.githubusercontent.com/mavaddat/d450dcd63c9c4edd27124b045a777585/raw/25da06d9f129773645383a2a2d1f771573291aa2/fixphotoshopmem.ps1')" 
  1. It will request elevated permissions to modify your registry. Allow this elevation.
  2. Now re-launch Adobe Photoshop. Check if it is resolved.
@Glennmartyn

This comment has been minimized.

Copy link

@Glennmartyn Glennmartyn commented May 21, 2018

I get this error unfortunately:

Exception calling "DownloadString" with "1" argument(s): "The request was aborted: Could not create SSL/TLS secure
channel."
At line:1 char:1

  • iex(New-Object Net.WebClient).DownloadString('https://gist.github.com ...
  •   + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
      + FullyQualifiedErrorId : WebException
    
    

Something to do with the wrong TLS maybe?

@Drout

This comment has been minimized.

Copy link

@Drout Drout commented Jun 22, 2018

Script should be flexible to handle older versions as well, not just the latest. The same registry settings applies.
"Photoshop\120.0"

@mavaddat

This comment has been minimized.

Copy link
Owner Author

@mavaddat mavaddat commented Jul 20, 2018

@Glennmartyn I have now updated the instructions to clarify how to prepare your PowerShell terminal for SSL/TLS Invoke-WebRequest. Please notice that I have merely implemented one of the solutions provided in this StackExchange discussion.
I now instruct people to preface the Invoke-Webrequest command with the code
[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls"
This allows PowerShell to communicate along secure HTTPS channels.

@mavaddat

This comment has been minimized.

Copy link
Owner Author

@mavaddat mavaddat commented Jul 21, 2018

@Drout I have now updated the script to be flexible to other versions of Adobe Photoshop. Good suggestion.

@NitolNeophyte

This comment has been minimized.

Copy link

@NitolNeophyte NitolNeophyte commented Dec 28, 2018

@mavaddat: thank you so so much........I had the problem titled "exception access violation" in CC 2018 version while trying to apply a function on a 'duplicate layer' of a photo........after creating this DWORD value now it's accessing about 1000MB in RAM and it's running with no error..........wish you good luck brother 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.