From 61c417a651d4322fc42b76fb5356f9519535fe6b Mon Sep 17 00:00:00 2001 From: Dmitry Nefedov Date: Sat, 16 Jul 2022 19:19:45 +0300 Subject: [PATCH] Fixed bug when CleanupTask function couldn't create a value in the BranchCache --- .../Sophia Script for Windows 10 LTSC 2019/Module/Sophia.psm1 | 4 ++++ .../Sophia Script for Windows 10 LTSC 2021/Module/Sophia.psm1 | 4 ++++ .../Module/Sophia.psm1 | 4 ++++ Sophia Script/Sophia Script for Windows 10/Module/Sophia.psm1 | 4 ++++ .../Module/Sophia.psm1 | 4 ++++ Sophia Script/Sophia Script for Windows 11/Module/Sophia.psm1 | 4 ++++ 6 files changed, 24 insertions(+) diff --git a/Sophia Script/Sophia Script for Windows 10 LTSC 2019/Module/Sophia.psm1 b/Sophia Script/Sophia Script for Windows 10 LTSC 2019/Module/Sophia.psm1 index e76b66f4f..f59f473c4 100644 --- a/Sophia Script/Sophia Script for Windows 10 LTSC 2019/Module/Sophia.psm1 +++ b/Sophia Script/Sophia Script for Windows 10 LTSC 2019/Module/Sophia.psm1 @@ -7375,6 +7375,10 @@ function CleanupTask ) foreach ($VolumeCache in $VolumeCaches) { + if (-not (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\$VolumeCache")) + { + New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\$VolumeCache" -Force + } New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\$VolumeCache" -Name StateFlags1337 -PropertyType DWord -Value 2 -Force } diff --git a/Sophia Script/Sophia Script for Windows 10 LTSC 2021/Module/Sophia.psm1 b/Sophia Script/Sophia Script for Windows 10 LTSC 2021/Module/Sophia.psm1 index a12bab4f8..f6fe9ee2c 100644 --- a/Sophia Script/Sophia Script for Windows 10 LTSC 2021/Module/Sophia.psm1 +++ b/Sophia Script/Sophia Script for Windows 10 LTSC 2021/Module/Sophia.psm1 @@ -8475,6 +8475,10 @@ function CleanupTask ) foreach ($VolumeCache in $VolumeCaches) { + if (-not (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\$VolumeCache")) + { + New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\$VolumeCache" -Force + } New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\$VolumeCache" -Name StateFlags1337 -PropertyType DWord -Value 2 -Force } diff --git a/Sophia Script/Sophia Script for Windows 10 PowerShell 7/Module/Sophia.psm1 b/Sophia Script/Sophia Script for Windows 10 PowerShell 7/Module/Sophia.psm1 index f48ca4b3b..28d3edf22 100644 --- a/Sophia Script/Sophia Script for Windows 10 PowerShell 7/Module/Sophia.psm1 +++ b/Sophia Script/Sophia Script for Windows 10 PowerShell 7/Module/Sophia.psm1 @@ -10729,6 +10729,10 @@ function CleanupTask ) foreach ($VolumeCache in $VolumeCaches) { + if (-not (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\$VolumeCache")) + { + New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\$VolumeCache" -Force + } New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\$VolumeCache" -Name StateFlags1337 -PropertyType DWord -Value 2 -Force } diff --git a/Sophia Script/Sophia Script for Windows 10/Module/Sophia.psm1 b/Sophia Script/Sophia Script for Windows 10/Module/Sophia.psm1 index 9bffbde02..084dee67a 100644 --- a/Sophia Script/Sophia Script for Windows 10/Module/Sophia.psm1 +++ b/Sophia Script/Sophia Script for Windows 10/Module/Sophia.psm1 @@ -10688,6 +10688,10 @@ function CleanupTask ) foreach ($VolumeCache in $VolumeCaches) { + if (-not (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\$VolumeCache")) + { + New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\$VolumeCache" -Force + } New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\$VolumeCache" -Name StateFlags1337 -PropertyType DWord -Value 2 -Force } diff --git a/Sophia Script/Sophia Script for Windows 11 PowerShell 7/Module/Sophia.psm1 b/Sophia Script/Sophia Script for Windows 11 PowerShell 7/Module/Sophia.psm1 index 170e8de21..f6221cc97 100644 --- a/Sophia Script/Sophia Script for Windows 11 PowerShell 7/Module/Sophia.psm1 +++ b/Sophia Script/Sophia Script for Windows 11 PowerShell 7/Module/Sophia.psm1 @@ -10192,6 +10192,10 @@ function CleanupTask ) foreach ($VolumeCache in $VolumeCaches) { + if (-not (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\$VolumeCache")) + { + New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\$VolumeCache" -Force + } New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\$VolumeCache" -Name StateFlags1337 -PropertyType DWord -Value 2 -Force } diff --git a/Sophia Script/Sophia Script for Windows 11/Module/Sophia.psm1 b/Sophia Script/Sophia Script for Windows 11/Module/Sophia.psm1 index d01c5d6c5..b50356b22 100644 --- a/Sophia Script/Sophia Script for Windows 11/Module/Sophia.psm1 +++ b/Sophia Script/Sophia Script for Windows 11/Module/Sophia.psm1 @@ -10152,6 +10152,10 @@ function CleanupTask ) foreach ($VolumeCache in $VolumeCaches) { + if (-not (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\$VolumeCache")) + { + New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\$VolumeCache" -Force + } New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\$VolumeCache" -Name StateFlags1337 -PropertyType DWord -Value 2 -Force }