From 9901114ce397e1f288036eeb86c412b7a30440b8 Mon Sep 17 00:00:00 2001 From: Dmitry Nefedov Date: Sun, 18 Jun 2023 23:48:23 +0300 Subject: [PATCH] Minor changes --- .../Module/Sophia.psm1 | 26 +++++++++++-------- .../Module/Sophia.psm1 | 26 +++++++++++-------- .../Module/Sophia.psm1 | 26 +++++++++++-------- .../Module/Sophia.psm1 | 26 +++++++++++-------- .../Module/Sophia.psm1 | 10 ++++--- .../Module/Sophia.psm1 | 26 +++++++++++-------- 6 files changed, 82 insertions(+), 58 deletions(-) diff --git a/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 index 55112858..bb6d5574 100644 --- a/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 @@ -5153,7 +5153,7 @@ function StorageSenseFrequency Hibernation -Disable .NOTES - Do not recommend turning it off on laptops + It isn't recommended to turn off for laptops .NOTES Current user @@ -6796,6 +6796,10 @@ function IPv6Component $PreferIPv4overIPv6 ) + Write-Information -MessageData "" -InformationAction Continue + # Extract the localized "Please wait..." string from shell32.dll + Write-Verbose -Message ([WinAPI.GetStr]::GetString(12612)) -Verbose + try { # Check the internet connection @@ -9759,7 +9763,7 @@ function Export-Associations if (Test-Path -Path "HKCU:\Software\Classes\$($_.ProgId)\Shell\Open\Command") { - if ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\Open\Command", "DelegateExecute", $null)) + if ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\open\command", "DelegateExecute", $null)) { $ProgramPath, $Icon = "" } @@ -9770,7 +9774,7 @@ function Export-Associations if (Test-Path -Path "Registry::HKEY_CLASSES_ROOT\$($_.ProgId)") { # ProgrammPath - if ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\Open\Command", "", $null)) + if ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\open\command", "", $null)) { $PartProgramPath = (Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Classes\$($_.ProgId)\Shell\Open\Command" -Name "(default)").Trim() $Program = $PartProgramPath.Substring(0, ($PartProgramPath.IndexOf(".exe") + 4)).Trim('"') @@ -9852,7 +9856,7 @@ function Export-Associations } } } - elseif ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\Open\Command", "", $null)) + elseif ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\open\command", "", $null)) { $IconPartPath = (Get-ItemPropertyValue -Path "HKCU:\Software\Classes\$($_.ProgId)\shell\open\command" -Name "(default)").Trim() $IconPath = $IconPartPath.Substring(0, $IconPartPath.IndexOf(".exe") + 4).Trim('"') @@ -12381,7 +12385,7 @@ function CleanupTask # Checking if notifications and Action Center are disabled # Due to "Set-StrictMode -Version Latest" we have to use GetValue() $UserNotificationCenter = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Explorer", "DisableNotificationCenter", $null) - $MachineNotificationCenter = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Explorer", "DisableNotificationCenter", $false) + $MachineNotificationCenter = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Explorer", "DisableNotificationCenter", $null) if (($UserNotificationCenter -eq 1) -or ($MachineNotificationCenter -eq 1)) { Write-Verbose -Message ($Localization.ActionCenter -f $MyInvocation.Line.Trim()) -Verbose @@ -12393,8 +12397,8 @@ function CleanupTask # Checking if Windows Script Host is disabled # Due to "Set-StrictMode -Version Latest" we have to use GetValue() - $UserScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings", "Enabled", $false) - $MachineScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings", "Enabled", $false) + $UserScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings", "Enabled", $null) + $MachineScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings", "Enabled", $null) if (($UserScriptHost -eq 0) -or ($MachineScriptHost -eq 0)) { Write-Verbose -Message ($Localization.WindowsScriptHost -f $MyInvocation.Line.Trim()) -Verbose @@ -12818,8 +12822,8 @@ function SoftwareDistributionTask { # Checking if Windows Script Host is disabled # Due to "Set-StrictMode -Version Latest" we have to use GetValue() - $UserScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings", "Enabled", $false) - $MachineScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings", "Enabled", $false) + $UserScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings", "Enabled", $null) + $MachineScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings", "Enabled", $null) if (($UserScriptHost -eq 0) -or ($MachineScriptHost -eq 0)) { Write-Verbose -Message ($Localization.WindowsScriptHost -f $MyInvocation.Line.Trim()) -Verbose @@ -13122,8 +13126,8 @@ function TempTask { # Checking if Windows Script Host is disabled # Due to "Set-StrictMode -Version Latest" we have to use GetValue() - $UserScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings", "Enabled", $false) - $MachineScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings", "Enabled", $false) + $UserScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings", "Enabled", $null) + $MachineScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings", "Enabled", $null) if (($UserScriptHost -eq 0) -or ($MachineScriptHost -eq 0)) { Write-Verbose -Message ($Localization.WindowsScriptHost -f $MyInvocation.Line.Trim()) -Verbose diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1 index 8615dec7..faddad0c 100644 --- a/src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1 @@ -3812,7 +3812,7 @@ function StorageSenseFrequency Hibernation -Disable .NOTES - Do not recommend turning it off on laptops + It isn't recommended to turn off for laptops .NOTES Current user @@ -5433,6 +5433,10 @@ function IPv6Component $PreferIPv4overIPv6 ) + Write-Information -MessageData "" -InformationAction Continue + # Extract the localized "Please wait..." string from shell32.dll + Write-Verbose -Message ([WinAPI.GetStr]::GetString(12612)) -Verbose + try { # Check the internet connection @@ -8101,7 +8105,7 @@ function Export-Associations if (Test-Path -Path "HKCU:\Software\Classes\$($_.ProgId)\Shell\Open\Command") { - if ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\Open\Command", "DelegateExecute", $null)) + if ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\open\command", "DelegateExecute", $null)) { $ProgramPath, $Icon = "" } @@ -8112,7 +8116,7 @@ function Export-Associations if (Test-Path -Path "Registry::HKEY_CLASSES_ROOT\$($_.ProgId)") { # ProgrammPath - if ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\Open\Command", "", $null)) + if ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\open\command", "", $null)) { $PartProgramPath = (Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Classes\$($_.ProgId)\Shell\Open\Command" -Name "(default)").Trim() $Program = $PartProgramPath.Substring(0, ($PartProgramPath.IndexOf(".exe") + 4)).Trim('"') @@ -8194,7 +8198,7 @@ function Export-Associations } } } - elseif ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\Open\Command", "", $null)) + elseif ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\open\command", "", $null)) { $IconPartPath = (Get-ItemPropertyValue -Path "HKCU:\Software\Classes\$($_.ProgId)\shell\open\command" -Name "(default)").Trim() $IconPath = $IconPartPath.Substring(0, $IconPartPath.IndexOf(".exe") + 4).Trim('"') @@ -8974,7 +8978,7 @@ function CleanupTask # Checking if notifications and Action Center are disabled # Due to "Set-StrictMode -Version Latest" we have to use GetValue() $UserNotificationCenter = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Explorer", "DisableNotificationCenter", $null) - $MachineNotificationCenter = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Explorer", "DisableNotificationCenter", $false) + $MachineNotificationCenter = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Explorer", "DisableNotificationCenter", $null) if (($UserNotificationCenter -eq 1) -or ($MachineNotificationCenter -eq 1)) { Write-Verbose -Message ($Localization.ActionCenter -f $MyInvocation.Line.Trim()) -Verbose @@ -8986,8 +8990,8 @@ function CleanupTask # Checking if Windows Script Host is disabled # Due to "Set-StrictMode -Version Latest" we have to use GetValue() - $UserScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings", "Enabled", $false) - $MachineScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings", "Enabled", $false) + $UserScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings", "Enabled", $null) + $MachineScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings", "Enabled", $null) if (($UserScriptHost -eq 0) -or ($MachineScriptHost -eq 0)) { Write-Verbose -Message ($Localization.WindowsScriptHost -f $MyInvocation.Line.Trim()) -Verbose @@ -9411,8 +9415,8 @@ function SoftwareDistributionTask { # Checking if Windows Script Host is disabled # Due to "Set-StrictMode -Version Latest" we have to use GetValue() - $UserScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings", "Enabled", $false) - $MachineScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings", "Enabled", $false) + $UserScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings", "Enabled", $null) + $MachineScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings", "Enabled", $null) if (($UserScriptHost -eq 0) -or ($MachineScriptHost -eq 0)) { Write-Verbose -Message ($Localization.WindowsScriptHost -f $MyInvocation.Line.Trim()) -Verbose @@ -9715,8 +9719,8 @@ function TempTask { # Checking if Windows Script Host is disabled # Due to "Set-StrictMode -Version Latest" we have to use GetValue() - $UserScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings", "Enabled", $false) - $MachineScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings", "Enabled", $false) + $UserScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings", "Enabled", $null) + $MachineScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings", "Enabled", $null) if (($UserScriptHost -eq 0) -or ($MachineScriptHost -eq 0)) { Write-Verbose -Message ($Localization.WindowsScriptHost -f $MyInvocation.Line.Trim()) -Verbose diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1 index d1fddd98..4a3caf1b 100644 --- a/src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1 @@ -4186,7 +4186,7 @@ function StorageSenseFrequency Hibernation -Disable .NOTES - Do not recommend turning it off on laptops + It isn't recommended to turn off for laptops .NOTES Current user @@ -5823,6 +5823,10 @@ function IPv6Component $PreferIPv4overIPv6 ) + Write-Information -MessageData "" -InformationAction Continue + # Extract the localized "Please wait..." string from shell32.dll + Write-Verbose -Message ([WinAPI.GetStr]::GetString(12612)) -Verbose + try { # Check the internet connection @@ -8729,7 +8733,7 @@ function Export-Associations if (Test-Path -Path "HKCU:\Software\Classes\$($_.ProgId)\Shell\Open\Command") { - if ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\Open\Command", "DelegateExecute", $null)) + if ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\open\command", "DelegateExecute", $null)) { $ProgramPath, $Icon = "" } @@ -8740,7 +8744,7 @@ function Export-Associations if (Test-Path -Path "Registry::HKEY_CLASSES_ROOT\$($_.ProgId)") { # ProgrammPath - if ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\Open\Command", "", $null)) + if ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\open\command", "", $null)) { $PartProgramPath = (Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Classes\$($_.ProgId)\Shell\Open\Command" -Name "(default)").Trim() $Program = $PartProgramPath.Substring(0, ($PartProgramPath.IndexOf(".exe") + 4)).Trim('"') @@ -8822,7 +8826,7 @@ function Export-Associations } } } - elseif ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\Open\Command", "", $null)) + elseif ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\open\command", "", $null)) { $IconPartPath = (Get-ItemPropertyValue -Path "HKCU:\Software\Classes\$($_.ProgId)\shell\open\command" -Name "(default)").Trim() $IconPath = $IconPartPath.Substring(0, $IconPartPath.IndexOf(".exe") + 4).Trim('"') @@ -10093,7 +10097,7 @@ function CleanupTask # Checking if notifications and Action Center are disabled # Due to "Set-StrictMode -Version Latest" we have to use GetValue() $UserNotificationCenter = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Explorer", "DisableNotificationCenter", $null) - $MachineNotificationCenter = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Explorer", "DisableNotificationCenter", $false) + $MachineNotificationCenter = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Explorer", "DisableNotificationCenter", $null) if (($UserNotificationCenter -eq 1) -or ($MachineNotificationCenter -eq 1)) { Write-Verbose -Message ($Localization.ActionCenter -f $MyInvocation.Line.Trim()) -Verbose @@ -10105,8 +10109,8 @@ function CleanupTask # Checking if Windows Script Host is disabled # Due to "Set-StrictMode -Version Latest" we have to use GetValue() - $UserScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings", "Enabled", $false) - $MachineScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings", "Enabled", $false) + $UserScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings", "Enabled", $null) + $MachineScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings", "Enabled", $null) if (($UserScriptHost -eq 0) -or ($MachineScriptHost -eq 0)) { Write-Verbose -Message ($Localization.WindowsScriptHost -f $MyInvocation.Line.Trim()) -Verbose @@ -10530,8 +10534,8 @@ function SoftwareDistributionTask { # Checking if Windows Script Host is disabled # Due to "Set-StrictMode -Version Latest" we have to use GetValue() - $UserScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings", "Enabled", $false) - $MachineScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings", "Enabled", $false) + $UserScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings", "Enabled", $null) + $MachineScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings", "Enabled", $null) if (($UserScriptHost -eq 0) -or ($MachineScriptHost -eq 0)) { Write-Verbose -Message ($Localization.WindowsScriptHost -f $MyInvocation.Line.Trim()) -Verbose @@ -10834,8 +10838,8 @@ function TempTask { # Checking if Windows Script Host is disabled # Due to "Set-StrictMode -Version Latest" we have to use GetValue() - $UserScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings", "Enabled", $false) - $MachineScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings", "Enabled", $false) + $UserScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings", "Enabled", $null) + $MachineScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings", "Enabled", $null) if (($UserScriptHost -eq 0) -or ($MachineScriptHost -eq 0)) { Write-Verbose -Message ($Localization.WindowsScriptHost -f $MyInvocation.Line.Trim()) -Verbose diff --git a/src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1 index 67cfe654..fb83868b 100644 --- a/src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1 @@ -5157,7 +5157,7 @@ function StorageSenseFrequency Hibernation -Disable .NOTES - Do not recommend turning it off on laptops + It isn't recommended to turn off for laptops .NOTES Current user @@ -6801,6 +6801,10 @@ function IPv6Component $PreferIPv4overIPv6 ) + Write-Information -MessageData "" -InformationAction Continue + # Extract the localized "Please wait..." string from shell32.dll + Write-Verbose -Message ([WinAPI.GetStr]::GetString(12612)) -Verbose + try { # Check the internet connection @@ -9764,7 +9768,7 @@ function Export-Associations if (Test-Path -Path "HKCU:\Software\Classes\$($_.ProgId)\Shell\Open\Command") { - if ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\Open\Command", "DelegateExecute", $null)) + if ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\open\command", "DelegateExecute", $null)) { $ProgramPath, $Icon = "" } @@ -9775,7 +9779,7 @@ function Export-Associations if (Test-Path -Path "Registry::HKEY_CLASSES_ROOT\$($_.ProgId)") { # ProgrammPath - if ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\Open\Command", "", $null)) + if ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\open\command", "", $null)) { $PartProgramPath = (Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Classes\$($_.ProgId)\Shell\Open\Command" -Name "(default)").Trim() $Program = $PartProgramPath.Substring(0, ($PartProgramPath.IndexOf(".exe") + 4)).Trim('"') @@ -9857,7 +9861,7 @@ function Export-Associations } } } - elseif ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\Open\Command", "", $null)) + elseif ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\open\command", "", $null)) { $IconPartPath = (Get-ItemPropertyValue -Path "HKCU:\Software\Classes\$($_.ProgId)\shell\open\command" -Name "(default)").Trim() $IconPath = $IconPartPath.Substring(0, $IconPartPath.IndexOf(".exe") + 4).Trim('"') @@ -12406,7 +12410,7 @@ function CleanupTask # Checking if notifications and Action Center are disabled # Due to "Set-StrictMode -Version Latest" we have to use GetValue() $UserNotificationCenter = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Explorer", "DisableNotificationCenter", $null) - $MachineNotificationCenter = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Explorer", "DisableNotificationCenter", $false) + $MachineNotificationCenter = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Explorer", "DisableNotificationCenter", $null) if (($UserNotificationCenter -eq 1) -or ($MachineNotificationCenter -eq 1)) { Write-Verbose -Message ($Localization.ActionCenter -f $MyInvocation.Line.Trim()) -Verbose @@ -12418,8 +12422,8 @@ function CleanupTask # Checking if Windows Script Host is disabled # Due to "Set-StrictMode -Version Latest" we have to use GetValue() - $UserScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings", "Enabled", $false) - $MachineScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings", "Enabled", $false) + $UserScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings", "Enabled", $null) + $MachineScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings", "Enabled", $null) if (($UserScriptHost -eq 0) -or ($MachineScriptHost -eq 0)) { Write-Verbose -Message ($Localization.WindowsScriptHost -f $MyInvocation.Line.Trim()) -Verbose @@ -12843,8 +12847,8 @@ function SoftwareDistributionTask { # Checking if Windows Script Host is disabled # Due to "Set-StrictMode -Version Latest" we have to use GetValue() - $UserScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings", "Enabled", $false) - $MachineScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings", "Enabled", $false) + $UserScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings", "Enabled", $null) + $MachineScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings", "Enabled", $null) if (($UserScriptHost -eq 0) -or ($MachineScriptHost -eq 0)) { Write-Verbose -Message ($Localization.WindowsScriptHost -f $MyInvocation.Line.Trim()) -Verbose @@ -13147,8 +13151,8 @@ function TempTask { # Checking if Windows Script Host is disabled # Due to "Set-StrictMode -Version Latest" we have to use GetValue() - $UserScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings", "Enabled", $false) - $MachineScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings", "Enabled", $false) + $UserScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings", "Enabled", $null) + $MachineScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings", "Enabled", $null) if (($UserScriptHost -eq 0) -or ($MachineScriptHost -eq 0)) { Write-Verbose -Message ($Localization.WindowsScriptHost -f $MyInvocation.Line.Trim()) -Verbose diff --git a/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1 index e7324ade..aef4af4f 100644 --- a/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1 @@ -6468,7 +6468,7 @@ function WindowsLatestUpdate PowerPlan -Balanced .NOTES - It isn't recommended to turn on the "High performance" power plan on laptops + It isn't recommended to turn on for laptops .NOTES Current user @@ -6648,6 +6648,10 @@ function IPv6Component $PreferIPv4overIPv6 ) + Write-Information -MessageData "" -InformationAction Continue + # Extract the localized "Please wait..." string from shell32.dll + Write-Verbose -Message ([WinAPI.GetStr]::GetString(12612)) -Verbose + try { # Check the internet connection @@ -9458,7 +9462,7 @@ function Export-Associations if (Test-Path -Path "HKCU:\Software\Classes\$($_.ProgId)\Shell\Open\Command") { - if ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\Open\Command", "DelegateExecute", $null)) + if ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\open\command", "DelegateExecute", $null)) { $ProgramPath, $Icon = "" } @@ -9469,7 +9473,7 @@ function Export-Associations if (Test-Path -Path "Registry::HKEY_CLASSES_ROOT\$($_.ProgId)") { # ProgrammPath - if ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\Open\Command", "", $null)) + if ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\open\command", "", $null)) { $PartProgramPath = (Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Classes\$($_.ProgId)\Shell\Open\Command" -Name "(default)").Trim() $Program = $PartProgramPath.Substring(0, ($PartProgramPath.IndexOf(".exe") + 4)).Trim('"') diff --git a/src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1 index 75f87c6e..06b8c208 100644 --- a/src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1 @@ -4808,7 +4808,7 @@ function StorageSenseFrequency Hibernation -Disable .NOTES - Do not recommend turning it off on laptops + It isn't recommended to turn off for laptops .NOTES Current user @@ -6653,6 +6653,10 @@ function IPv6Component $PreferIPv4overIPv6 ) + Write-Information -MessageData "" -InformationAction Continue + # Extract the localized "Please wait..." string from shell32.dll + Write-Verbose -Message ([WinAPI.GetStr]::GetString(12612)) -Verbose + try { # Check the internet connection @@ -9463,7 +9467,7 @@ function Export-Associations if (Test-Path -Path "HKCU:\Software\Classes\$($_.ProgId)\Shell\Open\Command") { - if ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\Open\Command", "DelegateExecute", $null)) + if ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\open\command", "DelegateExecute", $null)) { $ProgramPath, $Icon = "" } @@ -9474,7 +9478,7 @@ function Export-Associations if (Test-Path -Path "Registry::HKEY_CLASSES_ROOT\$($_.ProgId)") { # ProgrammPath - if ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\Open\Command", "", $null)) + if ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\open\command", "", $null)) { $PartProgramPath = (Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Classes\$($_.ProgId)\Shell\Open\Command" -Name "(default)").Trim() $Program = $PartProgramPath.Substring(0, ($PartProgramPath.IndexOf(".exe") + 4)).Trim('"') @@ -9556,7 +9560,7 @@ function Export-Associations } } } - elseif ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\Open\Command", "", $null)) + elseif ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Classes\$($_.ProgId)\shell\open\command", "", $null)) { $IconPartPath = (Get-ItemPropertyValue -Path "HKCU:\Software\Classes\$($_.ProgId)\shell\open\command" -Name "(default)").Trim() $IconPath = $IconPartPath.Substring(0, $IconPartPath.IndexOf(".exe") + 4).Trim('"') @@ -12009,7 +12013,7 @@ function CleanupTask # Checking if notifications and Action Center are disabled # Due to "Set-StrictMode -Version Latest" we have to use GetValue() $UserNotificationCenter = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Explorer", "DisableNotificationCenter", $null) - $MachineNotificationCenter = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Explorer", "DisableNotificationCenter", $false) + $MachineNotificationCenter = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Explorer", "DisableNotificationCenter", $null) if (($UserNotificationCenter -eq 1) -or ($MachineNotificationCenter -eq 1)) { Write-Verbose -Message ($Localization.ActionCenter -f $MyInvocation.Line.Trim()) -Verbose @@ -12021,8 +12025,8 @@ function CleanupTask # Checking if Windows Script Host is disabled # Due to "Set-StrictMode -Version Latest" we have to use GetValue() - $UserScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings", "Enabled", $false) - $MachineScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings", "Enabled", $false) + $UserScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings", "Enabled", $null) + $MachineScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings", "Enabled", $null) if (($UserScriptHost -eq 0) -or ($MachineScriptHost -eq 0)) { Write-Verbose -Message ($Localization.WindowsScriptHost -f $MyInvocation.Line.Trim()) -Verbose @@ -12446,8 +12450,8 @@ function SoftwareDistributionTask { # Checking if Windows Script Host is disabled # Due to "Set-StrictMode -Version Latest" we have to use GetValue() - $UserScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings", "Enabled", $false) - $MachineScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings", "Enabled", $false) + $UserScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings", "Enabled", $null) + $MachineScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings", "Enabled", $null) if (($UserScriptHost -eq 0) -or ($MachineScriptHost -eq 0)) { Write-Verbose -Message ($Localization.WindowsScriptHost -f $MyInvocation.Line.Trim()) -Verbose @@ -12750,8 +12754,8 @@ function TempTask { # Checking if Windows Script Host is disabled # Due to "Set-StrictMode -Version Latest" we have to use GetValue() - $UserScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings", "Enabled", $false) - $MachineScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings", "Enabled", $false) + $UserScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings", "Enabled", $null) + $MachineScriptHost = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings", "Enabled", $null) if (($UserScriptHost -eq 0) -or ($MachineScriptHost -eq 0)) { Write-Verbose -Message ($Localization.WindowsScriptHost -f $MyInvocation.Line.Trim()) -Verbose