Browse Source

Fixed typos

pull/500/head
Dmitry Nefedov 3 years ago
parent
commit
8eb786e39a
  1. 38
      src/Sophia_Script_for_Windows_10/Module/Sophia.psm1
  2. 6
      src/Sophia_Script_for_Windows_10/Sophia.ps1
  3. 38
      src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1
  4. 6
      src/Sophia_Script_for_Windows_10_LTSC_2019/Sophia.ps1
  5. 38
      src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1
  6. 6
      src/Sophia_Script_for_Windows_10_LTSC_2021/Sophia.ps1
  7. 38
      src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1
  8. 6
      src/Sophia_Script_for_Windows_10_PowerShell_7/Sophia.ps1
  9. 38
      src/Sophia_Script_for_Windows_11/Module/Sophia.psm1
  10. 6
      src/Sophia_Script_for_Windows_11/Sophia.ps1
  11. 38
      src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1
  12. 6
      src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1

38
src/Sophia_Script_for_Windows_10/Module/Sophia.psm1

@ -8934,13 +8934,13 @@ function Set-Association
if (-not (Test-Path -Path $ProgramPath)) if (-not (Test-Path -Path $ProgramPath))
{ {
# We cannot call here $MyInvocation.Line.Trim() to print function with error # We cannot call here $MyInvocation.Line.Trim() to print function with error
($Icon) if ($Icon)
{ {
Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath $ProgramPath -Extension $Extension -Icon $Icon") -ErrorAction SilentlyContinue Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath `"$ProgramPath`" -Extension $Extension -Icon `"$Icon`"") -ErrorAction SilentlyContinue
} }
else else
{ {
Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath $ProgramPath -Extension $Extension") -ErrorAction SilentlyContinue Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath `"$ProgramPath`" -Extension $Extension") -ErrorAction SilentlyContinue
} }
return return
@ -8952,13 +8952,13 @@ function Set-Association
if (-not (Test-Path -Path "Registry::HKEY_CLASSES_ROOT\$ProgramPath")) if (-not (Test-Path -Path "Registry::HKEY_CLASSES_ROOT\$ProgramPath"))
{ {
# We cannot call here $MyInvocation.Line.Trim() to print function with error # We cannot call here $MyInvocation.Line.Trim() to print function with error
($Icon) if ($Icon)
{ {
Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath $ProgramPath -Extension $Extension -Icon $Icon") -ErrorAction SilentlyContinue Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath `"$ProgramPath`" -Extension `"$Extension`" -Icon `"$Icon`"") -ErrorAction SilentlyContinue
} }
else else
{ {
Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath $ProgramPath -Extension $Extension") -ErrorAction SilentlyContinue Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath `"$ProgramPath`" -Extension `"$Extension`"") -ErrorAction SilentlyContinue
} }
return return
@ -9727,7 +9727,7 @@ public static void Refresh()
Export-Associations Export-Associations
.NOTES .NOTES
Associations will be exported as AppAssoc.json file in script root folder Associations will be exported as Application_Associations.json file in script root folder
.NOTES .NOTES
Import exported JSON file after a clean installation. You have to install all apps according to an exported JSON file to restore all associations Import exported JSON file after a clean installation. You have to install all apps according to an exported JSON file to restore all associations
@ -9737,14 +9737,14 @@ public static void Refresh()
#> #>
function Export-Associations function Export-Associations
{ {
Dism.exe /Online /Export-DefaultAppAssociations:"$env:TEMP\AppAssoc.xml" Dism.exe /Online /Export-DefaultAppAssociations:"$env:TEMP\Application_Associations.xml"
Clear-Variable -Name AllJSON, ProgramPath, Icon -ErrorAction Ignore Clear-Variable -Name AllJSON, ProgramPath, Icon -ErrorAction Ignore
$AllJSON = @() $AllJSON = @()
$AppxProgIds = @((Get-ChildItem -Path "Registry::HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Extensions\ProgIDs").PSChildName) $AppxProgIds = @((Get-ChildItem -Path "Registry::HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Extensions\ProgIDs").PSChildName)
[xml]$XML = Get-Content -Path "$env:TEMP\AppAssoc.xml" -Encoding UTF8 -Force [xml]$XML = Get-Content -Path "$env:TEMP\Application_Associations.xml" -Encoding UTF8 -Force
$XML.DefaultAssociations.Association | ForEach-Object -Process { $XML.DefaultAssociations.Association | ForEach-Object -Process {
if ($AppxProgIds -contains $_.ProgId) if ($AppxProgIds -contains $_.ProgId)
{ {
@ -9878,9 +9878,9 @@ function Export-Associations
$AllJSON += $JSON $AllJSON += $JSON
} }
$AllJSON | ConvertTo-Json | Set-Content -Path "$PSScriptRoot\..\AppAssoc.json" -Force -Encoding utf8 $AllJSON | ConvertTo-Json | Set-Content -Path "$PSScriptRoot\..\Application_Associations.json" -Force -Encoding utf8
Remove-Item -Path "$env:TEMP\AppAssoc.xml" -Force Remove-Item -Path "$env:TEMP\Application_Associations.xml" -Force
} }
<# <#
@ -9915,19 +9915,29 @@ function Import-Associations
{ {
$AppxProgIds = @((Get-ChildItem -Path "Registry::HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Extensions\ProgIDs").PSChildName) $AppxProgIds = @((Get-ChildItem -Path "Registry::HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Extensions\ProgIDs").PSChildName)
$JSON = Get-Content -Path $OpenFileDialog.FileName -Encoding UTF8 -Force | ConvertFrom-JSON try
{
$JSON = Get-Content -Path $OpenFileDialog.FileName -Encoding UTF8 -Force | ConvertFrom-JSON
}
catch [System.Exception]
{
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
}
$JSON | ForEach-Object -Process { $JSON | ForEach-Object -Process {
if ($AppxProgIds -contains $_.ProgId) if ($AppxProgIds -contains $_.ProgId)
{ {
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ([string]($_.ProgId, '|', $_.Extension)) -Verbose Write-Verbose -Message ([string]($_.ProgId, "|", $_.Extension)) -Verbose
Set-Association -ProgramPath $_.ProgId -Extension $_.Extension Set-Association -ProgramPath $_.ProgId -Extension $_.Extension
} }
else else
{ {
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ([string]($_.ProgrammPath, '|', $_.Extension, '|', $_.Icon)) -Verbose Write-Verbose -Message ([string]($_.ProgrammPath, "|", $_.Extension, "|", $_.Icon)) -Verbose
Set-Association -ProgramPath $_.ProgrammPath -Extension $_.Extension -Icon $_.Icon Set-Association -ProgramPath $_.ProgrammPath -Extension $_.Extension -Icon $_.Icon
} }

6
src/Sophia_Script_for_Windows_10/Sophia.ps1

@ -959,13 +959,13 @@ ActiveHours -Automatically
# Set-Association -ProgramPath "%ProgramFiles%\Notepad++\notepad++.exe" -Extension .txt -Icon "%ProgramFiles%\Notepad++\notepad++.exe,0" # Set-Association -ProgramPath "%ProgramFiles%\Notepad++\notepad++.exe" -Extension .txt -Icon "%ProgramFiles%\Notepad++\notepad++.exe,0"
<# <#
Export all Windows associations. Associations will be exported as AppAssoc.json file in script root folder Export all Windows associations. Associations will be exported as Application_Associations.json file in script root folder
Import exported JSON file after a clean installation. You have to install all apps according to an exported JSON file to restore all associations Import exported JSON file after a clean installation. You have to install all apps according to an exported JSON file to restore all associations
#> #>
Export-Associations # Export-Associations
# Import all Windows associations from a JSON file. You have to install all apps according to an exported JSON file to restore all associations # Import all Windows associations from a JSON file. You have to install all apps according to an exported JSON file to restore all associations
Import-Associations # Import-Associations
<# <#
Uninstall the "PC Health Check" app and prevent it from installing in the future Uninstall the "PC Health Check" app and prevent it from installing in the future

38
src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1

@ -7276,13 +7276,13 @@ function Set-Association
if (-not (Test-Path -Path $ProgramPath)) if (-not (Test-Path -Path $ProgramPath))
{ {
# We cannot call here $MyInvocation.Line.Trim() to print function with error # We cannot call here $MyInvocation.Line.Trim() to print function with error
($Icon) if ($Icon)
{ {
Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath $ProgramPath -Extension $Extension -Icon $Icon") -ErrorAction SilentlyContinue Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath `"$ProgramPath`" -Extension $Extension -Icon `"$Icon`"") -ErrorAction SilentlyContinue
} }
else else
{ {
Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath $ProgramPath -Extension $Extension") -ErrorAction SilentlyContinue Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath `"$ProgramPath`" -Extension $Extension") -ErrorAction SilentlyContinue
} }
return return
@ -7294,13 +7294,13 @@ function Set-Association
if (-not (Test-Path -Path "Registry::HKEY_CLASSES_ROOT\$ProgramPath")) if (-not (Test-Path -Path "Registry::HKEY_CLASSES_ROOT\$ProgramPath"))
{ {
# We cannot call here $MyInvocation.Line.Trim() to print function with error # We cannot call here $MyInvocation.Line.Trim() to print function with error
($Icon) if ($Icon)
{ {
Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath $ProgramPath -Extension $Extension -Icon $Icon") -ErrorAction SilentlyContinue Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath `"$ProgramPath`" -Extension `"$Extension`" -Icon `"$Icon`"") -ErrorAction SilentlyContinue
} }
else else
{ {
Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath $ProgramPath -Extension $Extension") -ErrorAction SilentlyContinue Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath `"$ProgramPath`" -Extension `"$Extension`"") -ErrorAction SilentlyContinue
} }
return return
@ -8069,7 +8069,7 @@ public static void Refresh()
Export-Associations Export-Associations
.NOTES .NOTES
Associations will be exported as AppAssoc.json file in script root folder Associations will be exported as Application_Associations.json file in script root folder
.NOTES .NOTES
Import exported JSON file after a clean installation. You have to install all apps according to an exported JSON file to restore all associations Import exported JSON file after a clean installation. You have to install all apps according to an exported JSON file to restore all associations
@ -8079,14 +8079,14 @@ public static void Refresh()
#> #>
function Export-Associations function Export-Associations
{ {
Dism.exe /Online /Export-DefaultAppAssociations:"$env:TEMP\AppAssoc.xml" Dism.exe /Online /Export-DefaultAppAssociations:"$env:TEMP\Application_Associations.xml"
Clear-Variable -Name AllJSON, ProgramPath, Icon -ErrorAction Ignore Clear-Variable -Name AllJSON, ProgramPath, Icon -ErrorAction Ignore
$AllJSON = @() $AllJSON = @()
$AppxProgIds = @((Get-ChildItem -Path "Registry::HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Extensions\ProgIDs").PSChildName) $AppxProgIds = @((Get-ChildItem -Path "Registry::HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Extensions\ProgIDs").PSChildName)
[xml]$XML = Get-Content -Path "$env:TEMP\AppAssoc.xml" -Encoding UTF8 -Force [xml]$XML = Get-Content -Path "$env:TEMP\Application_Associations.xml" -Encoding UTF8 -Force
$XML.DefaultAssociations.Association | ForEach-Object -Process { $XML.DefaultAssociations.Association | ForEach-Object -Process {
if ($AppxProgIds -contains $_.ProgId) if ($AppxProgIds -contains $_.ProgId)
{ {
@ -8220,9 +8220,9 @@ function Export-Associations
$AllJSON += $JSON $AllJSON += $JSON
} }
$AllJSON | ConvertTo-Json | Set-Content -Path "$PSScriptRoot\..\AppAssoc.json" -Force -Encoding utf8 $AllJSON | ConvertTo-Json | Set-Content -Path "$PSScriptRoot\..\Application_Associations.json" -Force -Encoding utf8
Remove-Item -Path "$env:TEMP\AppAssoc.xml" -Force Remove-Item -Path "$env:TEMP\Application_Associations.xml" -Force
} }
<# <#
@ -8257,19 +8257,29 @@ function Import-Associations
{ {
$AppxProgIds = @((Get-ChildItem -Path "Registry::HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Extensions\ProgIDs").PSChildName) $AppxProgIds = @((Get-ChildItem -Path "Registry::HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Extensions\ProgIDs").PSChildName)
$JSON = Get-Content -Path $OpenFileDialog.FileName -Encoding UTF8 -Force | ConvertFrom-JSON try
{
$JSON = Get-Content -Path $OpenFileDialog.FileName -Encoding UTF8 -Force | ConvertFrom-JSON
}
catch [System.Exception]
{
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
}
$JSON | ForEach-Object -Process { $JSON | ForEach-Object -Process {
if ($AppxProgIds -contains $_.ProgId) if ($AppxProgIds -contains $_.ProgId)
{ {
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ([string]($_.ProgId, '|', $_.Extension)) -Verbose Write-Verbose -Message ([string]($_.ProgId, "|", $_.Extension)) -Verbose
Set-Association -ProgramPath $_.ProgId -Extension $_.Extension Set-Association -ProgramPath $_.ProgId -Extension $_.Extension
} }
else else
{ {
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ([string]($_.ProgrammPath, '|', $_.Extension, '|', $_.Icon)) -Verbose Write-Verbose -Message ([string]($_.ProgrammPath, "|", $_.Extension, "|", $_.Icon)) -Verbose
Set-Association -ProgramPath $_.ProgrammPath -Extension $_.Extension -Icon $_.Icon Set-Association -ProgramPath $_.ProgrammPath -Extension $_.Extension -Icon $_.Icon
} }

6
src/Sophia_Script_for_Windows_10_LTSC_2019/Sophia.ps1

@ -768,13 +768,13 @@ ActiveHours -Automatically
# Set-Association -ProgramPath "%ProgramFiles%\Notepad++\notepad++.exe" -Extension .txt -Icon "%ProgramFiles%\Notepad++\notepad++.exe,0" # Set-Association -ProgramPath "%ProgramFiles%\Notepad++\notepad++.exe" -Extension .txt -Icon "%ProgramFiles%\Notepad++\notepad++.exe,0"
<# <#
Export all Windows associations. Associations will be exported as AppAssoc.json file in script root folder Export all Windows associations. Associations will be exported as Application_Associations.json file in script root folder
Import exported JSON file after a clean installation. You have to install all apps according to an exported JSON file to restore all associations Import exported JSON file after a clean installation. You have to install all apps according to an exported JSON file to restore all associations
#> #>
Export-Associations # Export-Associations
# Import all Windows associations from a JSON file. You have to install all apps according to an exported JSON file to restore all associations # Import all Windows associations from a JSON file. You have to install all apps according to an exported JSON file to restore all associations
Import-Associations # Import-Associations
<# <#
Install the latest Microsoft Visual C++ Redistributable Packages 20152022 (x86/x64) Install the latest Microsoft Visual C++ Redistributable Packages 20152022 (x86/x64)

38
src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1

@ -7904,13 +7904,13 @@ function Set-Association
if (-not (Test-Path -Path $ProgramPath)) if (-not (Test-Path -Path $ProgramPath))
{ {
# We cannot call here $MyInvocation.Line.Trim() to print function with error # We cannot call here $MyInvocation.Line.Trim() to print function with error
($Icon) if ($Icon)
{ {
Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath $ProgramPath -Extension $Extension -Icon $Icon") -ErrorAction SilentlyContinue Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath `"$ProgramPath`" -Extension $Extension -Icon `"$Icon`"") -ErrorAction SilentlyContinue
} }
else else
{ {
Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath $ProgramPath -Extension $Extension") -ErrorAction SilentlyContinue Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath `"$ProgramPath`" -Extension $Extension") -ErrorAction SilentlyContinue
} }
return return
@ -7922,13 +7922,13 @@ function Set-Association
if (-not (Test-Path -Path "Registry::HKEY_CLASSES_ROOT\$ProgramPath")) if (-not (Test-Path -Path "Registry::HKEY_CLASSES_ROOT\$ProgramPath"))
{ {
# We cannot call here $MyInvocation.Line.Trim() to print function with error # We cannot call here $MyInvocation.Line.Trim() to print function with error
($Icon) if ($Icon)
{ {
Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath $ProgramPath -Extension $Extension -Icon $Icon") -ErrorAction SilentlyContinue Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath `"$ProgramPath`" -Extension `"$Extension`" -Icon `"$Icon`"") -ErrorAction SilentlyContinue
} }
else else
{ {
Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath $ProgramPath -Extension $Extension") -ErrorAction SilentlyContinue Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath `"$ProgramPath`" -Extension `"$Extension`"") -ErrorAction SilentlyContinue
} }
return return
@ -8697,7 +8697,7 @@ public static void Refresh()
Export-Associations Export-Associations
.NOTES .NOTES
Associations will be exported as AppAssoc.json file in script root folder Associations will be exported as Application_Associations.json file in script root folder
.NOTES .NOTES
Import exported JSON file after a clean installation. You have to install all apps according to an exported JSON file to restore all associations Import exported JSON file after a clean installation. You have to install all apps according to an exported JSON file to restore all associations
@ -8707,14 +8707,14 @@ public static void Refresh()
#> #>
function Export-Associations function Export-Associations
{ {
Dism.exe /Online /Export-DefaultAppAssociations:"$env:TEMP\AppAssoc.xml" Dism.exe /Online /Export-DefaultAppAssociations:"$env:TEMP\Application_Associations.xml"
Clear-Variable -Name AllJSON, ProgramPath, Icon -ErrorAction Ignore Clear-Variable -Name AllJSON, ProgramPath, Icon -ErrorAction Ignore
$AllJSON = @() $AllJSON = @()
$AppxProgIds = @((Get-ChildItem -Path "Registry::HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Extensions\ProgIDs").PSChildName) $AppxProgIds = @((Get-ChildItem -Path "Registry::HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Extensions\ProgIDs").PSChildName)
[xml]$XML = Get-Content -Path "$env:TEMP\AppAssoc.xml" -Encoding UTF8 -Force [xml]$XML = Get-Content -Path "$env:TEMP\Application_Associations.xml" -Encoding UTF8 -Force
$XML.DefaultAssociations.Association | ForEach-Object -Process { $XML.DefaultAssociations.Association | ForEach-Object -Process {
if ($AppxProgIds -contains $_.ProgId) if ($AppxProgIds -contains $_.ProgId)
{ {
@ -8848,9 +8848,9 @@ function Export-Associations
$AllJSON += $JSON $AllJSON += $JSON
} }
$AllJSON | ConvertTo-Json | Set-Content -Path "$PSScriptRoot\..\AppAssoc.json" -Force -Encoding utf8 $AllJSON | ConvertTo-Json | Set-Content -Path "$PSScriptRoot\..\Application_Associations.json" -Force -Encoding utf8
Remove-Item -Path "$env:TEMP\AppAssoc.xml" -Force Remove-Item -Path "$env:TEMP\Application_Associations.xml" -Force
} }
<# <#
@ -8885,19 +8885,29 @@ function Import-Associations
{ {
$AppxProgIds = @((Get-ChildItem -Path "Registry::HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Extensions\ProgIDs").PSChildName) $AppxProgIds = @((Get-ChildItem -Path "Registry::HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Extensions\ProgIDs").PSChildName)
$JSON = Get-Content -Path $OpenFileDialog.FileName -Encoding UTF8 -Force | ConvertFrom-JSON try
{
$JSON = Get-Content -Path $OpenFileDialog.FileName -Encoding UTF8 -Force | ConvertFrom-JSON
}
catch [System.Exception]
{
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
}
$JSON | ForEach-Object -Process { $JSON | ForEach-Object -Process {
if ($AppxProgIds -contains $_.ProgId) if ($AppxProgIds -contains $_.ProgId)
{ {
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ([string]($_.ProgId, '|', $_.Extension)) -Verbose Write-Verbose -Message ([string]($_.ProgId, "|", $_.Extension)) -Verbose
Set-Association -ProgramPath $_.ProgId -Extension $_.Extension Set-Association -ProgramPath $_.ProgId -Extension $_.Extension
} }
else else
{ {
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ([string]($_.ProgrammPath, '|', $_.Extension, '|', $_.Icon)) -Verbose Write-Verbose -Message ([string]($_.ProgrammPath, "|", $_.Extension, "|", $_.Icon)) -Verbose
Set-Association -ProgramPath $_.ProgrammPath -Extension $_.Extension -Icon $_.Icon Set-Association -ProgramPath $_.ProgrammPath -Extension $_.Extension -Icon $_.Icon
} }

6
src/Sophia_Script_for_Windows_10_LTSC_2021/Sophia.ps1

@ -865,13 +865,13 @@ ActiveHours -Automatically
# Set-Association -ProgramPath "%ProgramFiles%\Notepad++\notepad++.exe" -Extension .txt -Icon "%ProgramFiles%\Notepad++\notepad++.exe,0" # Set-Association -ProgramPath "%ProgramFiles%\Notepad++\notepad++.exe" -Extension .txt -Icon "%ProgramFiles%\Notepad++\notepad++.exe,0"
<# <#
Export all Windows associations. Associations will be exported as AppAssoc.json file in script root folder Export all Windows associations. Associations will be exported as Application_Associations.json file in script root folder
Import exported JSON file after a clean installation. You have to install all apps according to an exported JSON file to restore all associations Import exported JSON file after a clean installation. You have to install all apps according to an exported JSON file to restore all associations
#> #>
Export-Associations # Export-Associations
# Import all Windows associations from a JSON file. You have to install all apps according to an exported JSON file to restore all associations # Import all Windows associations from a JSON file. You have to install all apps according to an exported JSON file to restore all associations
Import-Associations # Import-Associations
<# <#
Install the latest Microsoft Visual C++ Redistributable Packages 20152022 (x86/x64) Install the latest Microsoft Visual C++ Redistributable Packages 20152022 (x86/x64)

38
src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1

@ -8939,13 +8939,13 @@ function Set-Association
if (-not (Test-Path -Path $ProgramPath)) if (-not (Test-Path -Path $ProgramPath))
{ {
# We cannot call here $MyInvocation.Line.Trim() to print function with error # We cannot call here $MyInvocation.Line.Trim() to print function with error
($Icon) if ($Icon)
{ {
Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath $ProgramPath -Extension $Extension -Icon $Icon") -ErrorAction SilentlyContinue Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath `"$ProgramPath`" -Extension $Extension -Icon `"$Icon`"") -ErrorAction SilentlyContinue
} }
else else
{ {
Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath $ProgramPath -Extension $Extension") -ErrorAction SilentlyContinue Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath `"$ProgramPath`" -Extension $Extension") -ErrorAction SilentlyContinue
} }
return return
@ -8957,13 +8957,13 @@ function Set-Association
if (-not (Test-Path -Path "Registry::HKEY_CLASSES_ROOT\$ProgramPath")) if (-not (Test-Path -Path "Registry::HKEY_CLASSES_ROOT\$ProgramPath"))
{ {
# We cannot call here $MyInvocation.Line.Trim() to print function with error # We cannot call here $MyInvocation.Line.Trim() to print function with error
($Icon) if ($Icon)
{ {
Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath $ProgramPath -Extension $Extension -Icon $Icon") -ErrorAction SilentlyContinue Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath `"$ProgramPath`" -Extension `"$Extension`" -Icon `"$Icon`"") -ErrorAction SilentlyContinue
} }
else else
{ {
Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath $ProgramPath -Extension $Extension") -ErrorAction SilentlyContinue Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath `"$ProgramPath`" -Extension `"$Extension`"") -ErrorAction SilentlyContinue
} }
return return
@ -9732,7 +9732,7 @@ public static void Refresh()
Export-Associations Export-Associations
.NOTES .NOTES
Associations will be exported as AppAssoc.json file in script root folder Associations will be exported as Application_Associations.json file in script root folder
.NOTES .NOTES
Import exported JSON file after a clean installation. You have to install all apps according to an exported JSON file to restore all associations Import exported JSON file after a clean installation. You have to install all apps according to an exported JSON file to restore all associations
@ -9742,14 +9742,14 @@ public static void Refresh()
#> #>
function Export-Associations function Export-Associations
{ {
Dism.exe /Online /Export-DefaultAppAssociations:"$env:TEMP\AppAssoc.xml" Dism.exe /Online /Export-DefaultAppAssociations:"$env:TEMP\Application_Associations.xml"
Clear-Variable -Name AllJSON, ProgramPath, Icon -ErrorAction Ignore Clear-Variable -Name AllJSON, ProgramPath, Icon -ErrorAction Ignore
$AllJSON = @() $AllJSON = @()
$AppxProgIds = @((Get-ChildItem -Path "Registry::HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Extensions\ProgIDs").PSChildName) $AppxProgIds = @((Get-ChildItem -Path "Registry::HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Extensions\ProgIDs").PSChildName)
[xml]$XML = Get-Content -Path "$env:TEMP\AppAssoc.xml" -Encoding UTF8 -Force [xml]$XML = Get-Content -Path "$env:TEMP\Application_Associations.xml" -Encoding UTF8 -Force
$XML.DefaultAssociations.Association | ForEach-Object -Process { $XML.DefaultAssociations.Association | ForEach-Object -Process {
if ($AppxProgIds -contains $_.ProgId) if ($AppxProgIds -contains $_.ProgId)
{ {
@ -9883,9 +9883,9 @@ function Export-Associations
$AllJSON += $JSON $AllJSON += $JSON
} }
$AllJSON | ConvertTo-Json | Set-Content -Path "$PSScriptRoot\..\AppAssoc.json" -Force -Encoding utf8 $AllJSON | ConvertTo-Json | Set-Content -Path "$PSScriptRoot\..\Application_Associations.json" -Force -Encoding utf8
Remove-Item -Path "$env:TEMP\AppAssoc.xml" -Force Remove-Item -Path "$env:TEMP\Application_Associations.xml" -Force
} }
<# <#
@ -9920,19 +9920,29 @@ function Import-Associations
{ {
$AppxProgIds = @((Get-ChildItem -Path "Registry::HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Extensions\ProgIDs").PSChildName) $AppxProgIds = @((Get-ChildItem -Path "Registry::HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Extensions\ProgIDs").PSChildName)
$JSON = Get-Content -Path $OpenFileDialog.FileName -Encoding UTF8 -Force | ConvertFrom-JSON try
{
$JSON = Get-Content -Path $OpenFileDialog.FileName -Encoding UTF8 -Force | ConvertFrom-JSON
}
catch [System.Exception]
{
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
}
$JSON | ForEach-Object -Process { $JSON | ForEach-Object -Process {
if ($AppxProgIds -contains $_.ProgId) if ($AppxProgIds -contains $_.ProgId)
{ {
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ([string]($_.ProgId, '|', $_.Extension)) -Verbose Write-Verbose -Message ([string]($_.ProgId, "|", $_.Extension)) -Verbose
Set-Association -ProgramPath $_.ProgId -Extension $_.Extension Set-Association -ProgramPath $_.ProgId -Extension $_.Extension
} }
else else
{ {
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ([string]($_.ProgrammPath, '|', $_.Extension, '|', $_.Icon)) -Verbose Write-Verbose -Message ([string]($_.ProgrammPath, "|", $_.Extension, "|", $_.Icon)) -Verbose
Set-Association -ProgramPath $_.ProgrammPath -Extension $_.Extension -Icon $_.Icon Set-Association -ProgramPath $_.ProgrammPath -Extension $_.Extension -Icon $_.Icon
} }

6
src/Sophia_Script_for_Windows_10_PowerShell_7/Sophia.ps1

@ -968,13 +968,13 @@ ActiveHours -Automatically
# Set-Association -ProgramPath "%ProgramFiles%\Notepad++\notepad++.exe" -Extension .txt -Icon "%ProgramFiles%\Notepad++\notepad++.exe,0" # Set-Association -ProgramPath "%ProgramFiles%\Notepad++\notepad++.exe" -Extension .txt -Icon "%ProgramFiles%\Notepad++\notepad++.exe,0"
<# <#
Export all Windows associations. Associations will be exported as AppAssoc.json file in script root folder Export all Windows associations. Associations will be exported as Application_Associations.json file in script root folder
Import exported JSON file after a clean installation. You have to install all apps according to an exported JSON file to restore all associations Import exported JSON file after a clean installation. You have to install all apps according to an exported JSON file to restore all associations
#> #>
Export-Associations # Export-Associations
# Import all Windows associations from a JSON file. You have to install all apps according to an exported JSON file to restore all associations # Import all Windows associations from a JSON file. You have to install all apps according to an exported JSON file to restore all associations
Import-Associations # Import-Associations
<# <#
Uninstall the "PC Health Check" app and prevent it from installing in the future Uninstall the "PC Health Check" app and prevent it from installing in the future

38
src/Sophia_Script_for_Windows_11/Module/Sophia.psm1

@ -8611,13 +8611,13 @@ function Set-Association
if (-not (Test-Path -Path $ProgramPath)) if (-not (Test-Path -Path $ProgramPath))
{ {
# We cannot call here $MyInvocation.Line.Trim() to print function with error # We cannot call here $MyInvocation.Line.Trim() to print function with error
($Icon) if ($Icon)
{ {
Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath $ProgramPath -Extension $Extension -Icon $Icon") -ErrorAction SilentlyContinue Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath `"$ProgramPath`" -Extension $Extension -Icon `"$Icon`"") -ErrorAction SilentlyContinue
} }
else else
{ {
Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath $ProgramPath -Extension $Extension") -ErrorAction SilentlyContinue Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath `"$ProgramPath`" -Extension $Extension") -ErrorAction SilentlyContinue
} }
return return
@ -8629,13 +8629,13 @@ function Set-Association
if (-not (Test-Path -Path "Registry::HKEY_CLASSES_ROOT\$ProgramPath")) if (-not (Test-Path -Path "Registry::HKEY_CLASSES_ROOT\$ProgramPath"))
{ {
# We cannot call here $MyInvocation.Line.Trim() to print function with error # We cannot call here $MyInvocation.Line.Trim() to print function with error
($Icon) if ($Icon)
{ {
Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath $ProgramPath -Extension $Extension -Icon $Icon") -ErrorAction SilentlyContinue Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath `"$ProgramPath`" -Extension `"$Extension`" -Icon `"$Icon`"") -ErrorAction SilentlyContinue
} }
else else
{ {
Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath $ProgramPath -Extension $Extension") -ErrorAction SilentlyContinue Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath `"$ProgramPath`" -Extension `"$Extension`"") -ErrorAction SilentlyContinue
} }
return return
@ -9404,7 +9404,7 @@ public static void Refresh()
Export-Associations Export-Associations
.NOTES .NOTES
Associations will be exported as AppAssoc.json file in script root folder Associations will be exported as Application_Associations.json file in script root folder
.NOTES .NOTES
Import exported JSON file after a clean installation. You have to install all apps according to an exported JSON file to restore all associations Import exported JSON file after a clean installation. You have to install all apps according to an exported JSON file to restore all associations
@ -9414,14 +9414,14 @@ public static void Refresh()
#> #>
function Export-Associations function Export-Associations
{ {
Dism.exe /Online /Export-DefaultAppAssociations:"$env:TEMP\AppAssoc.xml" Dism.exe /Online /Export-DefaultAppAssociations:"$env:TEMP\Application_Associations.xml"
Clear-Variable -Name AllJSON, ProgramPath, Icon -ErrorAction Ignore Clear-Variable -Name AllJSON, ProgramPath, Icon -ErrorAction Ignore
$AllJSON = @() $AllJSON = @()
$AppxProgIds = @((Get-ChildItem -Path "Registry::HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Extensions\ProgIDs").PSChildName) $AppxProgIds = @((Get-ChildItem -Path "Registry::HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Extensions\ProgIDs").PSChildName)
[xml]$XML = Get-Content -Path "$env:TEMP\AppAssoc.xml" -Encoding UTF8 -Force [xml]$XML = Get-Content -Path "$env:TEMP\Application_Associations.xml" -Encoding UTF8 -Force
$XML.DefaultAssociations.Association | ForEach-Object -Process { $XML.DefaultAssociations.Association | ForEach-Object -Process {
if ($AppxProgIds -contains $_.ProgId) if ($AppxProgIds -contains $_.ProgId)
{ {
@ -9555,9 +9555,9 @@ function Export-Associations
$AllJSON += $JSON $AllJSON += $JSON
} }
$AllJSON | ConvertTo-Json | Set-Content -Path "$PSScriptRoot\..\AppAssoc.json" -Force -Encoding utf8 $AllJSON | ConvertTo-Json | Set-Content -Path "$PSScriptRoot\..\Application_Associations.json" -Force -Encoding utf8
Remove-Item -Path "$env:TEMP\AppAssoc.xml" -Force Remove-Item -Path "$env:TEMP\Application_Associations.xml" -Force
} }
<# <#
@ -9592,19 +9592,29 @@ function Import-Associations
{ {
$AppxProgIds = @((Get-ChildItem -Path "Registry::HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Extensions\ProgIDs").PSChildName) $AppxProgIds = @((Get-ChildItem -Path "Registry::HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Extensions\ProgIDs").PSChildName)
$JSON = Get-Content -Path $OpenFileDialog.FileName -Encoding UTF8 -Force | ConvertFrom-JSON try
{
$JSON = Get-Content -Path $OpenFileDialog.FileName -Encoding UTF8 -Force | ConvertFrom-JSON
}
catch [System.Exception]
{
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
}
$JSON | ForEach-Object -Process { $JSON | ForEach-Object -Process {
if ($AppxProgIds -contains $_.ProgId) if ($AppxProgIds -contains $_.ProgId)
{ {
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ([string]($_.ProgId, '|', $_.Extension)) -Verbose Write-Verbose -Message ([string]($_.ProgId, "|", $_.Extension)) -Verbose
Set-Association -ProgramPath $_.ProgId -Extension $_.Extension Set-Association -ProgramPath $_.ProgId -Extension $_.Extension
} }
else else
{ {
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ([string]($_.ProgrammPath, '|', $_.Extension, '|', $_.Icon)) -Verbose Write-Verbose -Message ([string]($_.ProgrammPath, "|", $_.Extension, "|", $_.Icon)) -Verbose
Set-Association -ProgramPath $_.ProgrammPath -Extension $_.Extension -Icon $_.Icon Set-Association -ProgramPath $_.ProgrammPath -Extension $_.Extension -Icon $_.Icon
} }

6
src/Sophia_Script_for_Windows_11/Sophia.ps1

@ -914,13 +914,13 @@ WindowsLatestUpdate -Disable
# Set-Association -ProgramPath "%ProgramFiles%\Notepad++\notepad++.exe" -Extension .txt -Icon "%ProgramFiles%\Notepad++\notepad++.exe,0" # Set-Association -ProgramPath "%ProgramFiles%\Notepad++\notepad++.exe" -Extension .txt -Icon "%ProgramFiles%\Notepad++\notepad++.exe,0"
<# <#
Export all Windows associations. Associations will be exported as AppAssoc.json file in script root folder Export all Windows associations. Associations will be exported as Application_Associations.json file in script root folder
Import exported JSON file after a clean installation. You have to install all apps according to an exported JSON file to restore all associations Import exported JSON file after a clean installation. You have to install all apps according to an exported JSON file to restore all associations
#> #>
Export-Associations # Export-Associations
# Import all Windows associations from a JSON file. You have to install all apps according to an exported JSON file to restore all associations # Import all Windows associations from a JSON file. You have to install all apps according to an exported JSON file to restore all associations
Import-Associations # Import-Associations
# Set Windows Terminal as default terminal app to host the user interface for command-line applications # Set Windows Terminal as default terminal app to host the user interface for command-line applications
# Установить Windows Terminal как приложение терминала по умолчанию для размещения пользовательского интерфейса для приложений командной строки # Установить Windows Terminal как приложение терминала по умолчанию для размещения пользовательского интерфейса для приложений командной строки

38
src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1

@ -8616,13 +8616,13 @@ function Set-Association
if (-not (Test-Path -Path $ProgramPath)) if (-not (Test-Path -Path $ProgramPath))
{ {
# We cannot call here $MyInvocation.Line.Trim() to print function with error # We cannot call here $MyInvocation.Line.Trim() to print function with error
($Icon) if ($Icon)
{ {
Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath $ProgramPath -Extension $Extension -Icon $Icon") -ErrorAction SilentlyContinue Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath `"$ProgramPath`" -Extension $Extension -Icon `"$Icon`"") -ErrorAction SilentlyContinue
} }
else else
{ {
Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath $ProgramPath -Extension $Extension") -ErrorAction SilentlyContinue Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath `"$ProgramPath`" -Extension $Extension") -ErrorAction SilentlyContinue
} }
return return
@ -8634,13 +8634,13 @@ function Set-Association
if (-not (Test-Path -Path "Registry::HKEY_CLASSES_ROOT\$ProgramPath")) if (-not (Test-Path -Path "Registry::HKEY_CLASSES_ROOT\$ProgramPath"))
{ {
# We cannot call here $MyInvocation.Line.Trim() to print function with error # We cannot call here $MyInvocation.Line.Trim() to print function with error
($Icon) if ($Icon)
{ {
Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath $ProgramPath -Extension $Extension -Icon $Icon") -ErrorAction SilentlyContinue Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath `"$ProgramPath`" -Extension `"$Extension`" -Icon `"$Icon`"") -ErrorAction SilentlyContinue
} }
else else
{ {
Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath $ProgramPath -Extension $Extension") -ErrorAction SilentlyContinue Write-Error -Message ($Localization.RestartFunction -f "Set-Association -ProgramPath `"$ProgramPath`" -Extension `"$Extension`"") -ErrorAction SilentlyContinue
} }
return return
@ -9409,7 +9409,7 @@ public static void Refresh()
Export-Associations Export-Associations
.NOTES .NOTES
Associations will be exported as AppAssoc.json file in script root folder Associations will be exported as Application_Associations.json file in script root folder
.NOTES .NOTES
Import exported JSON file after a clean installation. You have to install all apps according to an exported JSON file to restore all associations Import exported JSON file after a clean installation. You have to install all apps according to an exported JSON file to restore all associations
@ -9419,14 +9419,14 @@ public static void Refresh()
#> #>
function Export-Associations function Export-Associations
{ {
Dism.exe /Online /Export-DefaultAppAssociations:"$env:TEMP\AppAssoc.xml" Dism.exe /Online /Export-DefaultAppAssociations:"$env:TEMP\Application_Associations.xml"
Clear-Variable -Name AllJSON, ProgramPath, Icon -ErrorAction Ignore Clear-Variable -Name AllJSON, ProgramPath, Icon -ErrorAction Ignore
$AllJSON = @() $AllJSON = @()
$AppxProgIds = @((Get-ChildItem -Path "Registry::HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Extensions\ProgIDs").PSChildName) $AppxProgIds = @((Get-ChildItem -Path "Registry::HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Extensions\ProgIDs").PSChildName)
[xml]$XML = Get-Content -Path "$env:TEMP\AppAssoc.xml" -Encoding UTF8 -Force [xml]$XML = Get-Content -Path "$env:TEMP\Application_Associations.xml" -Encoding UTF8 -Force
$XML.DefaultAssociations.Association | ForEach-Object -Process { $XML.DefaultAssociations.Association | ForEach-Object -Process {
if ($AppxProgIds -contains $_.ProgId) if ($AppxProgIds -contains $_.ProgId)
{ {
@ -9560,9 +9560,9 @@ function Export-Associations
$AllJSON += $JSON $AllJSON += $JSON
} }
$AllJSON | ConvertTo-Json | Set-Content -Path "$PSScriptRoot\..\AppAssoc.json" -Force -Encoding utf8 $AllJSON | ConvertTo-Json | Set-Content -Path "$PSScriptRoot\..\Application_Associations.json" -Force -Encoding utf8
Remove-Item -Path "$env:TEMP\AppAssoc.xml" -Force Remove-Item -Path "$env:TEMP\Application_Associations.xml" -Force
} }
<# <#
@ -9597,19 +9597,29 @@ function Import-Associations
{ {
$AppxProgIds = @((Get-ChildItem -Path "Registry::HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Extensions\ProgIDs").PSChildName) $AppxProgIds = @((Get-ChildItem -Path "Registry::HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Extensions\ProgIDs").PSChildName)
$JSON = Get-Content -Path $OpenFileDialog.FileName -Encoding UTF8 -Force | ConvertFrom-JSON try
{
$JSON = Get-Content -Path $OpenFileDialog.FileName -Encoding UTF8 -Force | ConvertFrom-JSON
}
catch [System.Exception]
{
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
}
$JSON | ForEach-Object -Process { $JSON | ForEach-Object -Process {
if ($AppxProgIds -contains $_.ProgId) if ($AppxProgIds -contains $_.ProgId)
{ {
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ([string]($_.ProgId, '|', $_.Extension)) -Verbose Write-Verbose -Message ([string]($_.ProgId, "|", $_.Extension)) -Verbose
Set-Association -ProgramPath $_.ProgId -Extension $_.Extension Set-Association -ProgramPath $_.ProgId -Extension $_.Extension
} }
else else
{ {
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ([string]($_.ProgrammPath, '|', $_.Extension, '|', $_.Icon)) -Verbose Write-Verbose -Message ([string]($_.ProgrammPath, "|", $_.Extension, "|", $_.Icon)) -Verbose
Set-Association -ProgramPath $_.ProgrammPath -Extension $_.Extension -Icon $_.Icon Set-Association -ProgramPath $_.ProgrammPath -Extension $_.Extension -Icon $_.Icon
} }

6
src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1

@ -915,13 +915,13 @@ NetworkDiscovery -Enable
# Set-Association -ProgramPath "%ProgramFiles%\Notepad++\notepad++.exe" -Extension .txt -Icon "%ProgramFiles%\Notepad++\notepad++.exe,0" # Set-Association -ProgramPath "%ProgramFiles%\Notepad++\notepad++.exe" -Extension .txt -Icon "%ProgramFiles%\Notepad++\notepad++.exe,0"
<# <#
Export all Windows associations. Associations will be exported as AppAssoc.json file in script root folder Export all Windows associations. Associations will be exported as Application_Associations.json file in script root folder
Import exported JSON file after a clean installation. You have to install all apps according to an exported JSON file to restore all associations Import exported JSON file after a clean installation. You have to install all apps according to an exported JSON file to restore all associations
#> #>
Export-Associations # Export-Associations
# Import all Windows associations from a JSON file. You have to install all apps according to an exported JSON file to restore all associations # Import all Windows associations from a JSON file. You have to install all apps according to an exported JSON file to restore all associations
Import-Associations # Import-Associations
# Set Windows Terminal as default terminal app to host the user interface for command-line applications # Set Windows Terminal as default terminal app to host the user interface for command-line applications
# Установить Windows Terminal как приложение терминала по умолчанию для размещения пользовательского интерфейса для приложений командной строки # Установить Windows Terminal как приложение терминала по умолчанию для размещения пользовательского интерфейса для приложений командной строки

Loading…
Cancel
Save