-
-
Save Siddharaj6010/fd9ed2139da67d553a18b223b8abb8c7 to your computer and use it in GitHub Desktop.
Powershell script to fix Adobe Photoshop CC memory issue #2416657
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
$registryPath = "HKCU:\Software\Adobe\Photoshop\120.0\" | |
$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(!(Test-Path $registryPath)) | |
{ | |
New-Item -Path $registryPath -Verbose | |
New-ItemProperty -Path $registryPath -Name $name -Value $value -PropertyType DWORD -Force -Verbose | |
} | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To run this in your PowerShell without modifying your execution policy, try this:
powershell -nop -c "iex(New-Object Net.WebClient).DownloadString('https://gist.github.com/mavaddat/d450dcd63c9c4edd27124b045a777585/raw/64f257a1e6cd5141fa65dc7bac7dcb1644e7d6c5/fixphotoshopmem.ps1 ')"