Browse Source

Removed `PreventTeamsInstallation` function for `Windows 11`

master
Dmitry Nefedov 2 months ago
parent
commit
bd77966652
  1. 16
      Wrapper/Config/config_Windows_11.json
  2. 14
      Wrapper/Localizations/de-DE/tooltip_Windows_11.json
  3. 14
      Wrapper/Localizations/en-US/tooltip_Windows_11.json
  4. 14
      Wrapper/Localizations/ru-RU/tooltip_Windows_11.json
  5. 62
      src/Sophia_Script_for_Windows_10/Module/Sophia.psm1
  6. 62
      src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1
  7. 62
      src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1
  8. 62
      src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1
  9. 133
      src/Sophia_Script_for_Windows_11/Module/Sophia.psm1
  10. 8
      src/Sophia_Script_for_Windows_11/Sophia.ps1
  11. 62
      src/Sophia_Script_for_Windows_11_LTSC_2024/Module/Sophia.psm1
  12. 133
      src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1
  13. 8
      src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1

16
Wrapper/Config/config_Windows_11.json

@ -623,22 +623,6 @@
"Preset": "Zero",
"WindowsDefault": "One"
},
{
"Region": "UI & Personalization",
"Control": "cmb",
"Required": "false",
"Function": "PreventTeamsInstallation",
"Arg": {
"Zero": {
"Tag": "Enable"
},
"One": {
"Tag": "Disable"
}
},
"Preset": "Zero",
"WindowsDefault": "One"
},
{
"Region": "UI & Personalization",
"Control": "cmb",

14
Wrapper/Localizations/de-DE/tooltip_Windows_11.json

@ -545,20 +545,6 @@
}
}
},
{
"Region": "UI & Personalization",
"Function": "PreventTeamsInstallation",
"Arg": {
"Zero": {
"Tag": "Enable",
"ToolTip": "Blenden Sie das Chat-Symbol (Microsoft Teams) in der Taskleiste aus und verhindern Sie, dass Microsoft Teams für neue Benutzer installiert wird."
},
"One": {
"Tag": "Disable",
"ToolTip": "Zeigen Sie das Chat-Symbol (Microsoft Teams) in der Taskleiste an und entfernen Sie die Sperre für die Installation von Microsoft Teams für neue Benutzer (Standardeinstellung)."
}
}
},
{
"Region": "UI & Personalization",
"Function": "SecondsInSystemClock",

14
Wrapper/Localizations/en-US/tooltip_Windows_11.json

@ -545,20 +545,6 @@
}
}
},
{
"Region": "UI & Personalization",
"Function": "PreventTeamsInstallation",
"Arg": {
"Zero": {
"Tag": "Enable",
"ToolTip": "Hide the Chat icon (Microsoft Teams) on the taskbar and prevent Microsoft Teams from installing for new users."
},
"One": {
"Tag": "Disable",
"ToolTip": "Show the Chat icon (Microsoft Teams) on the taskbar and remove block from installing Microsoft Teams for new users (default value)."
}
}
},
{
"Region": "UI & Personalization",
"Function": "SecondsInSystemClock",

14
Wrapper/Localizations/ru-RU/tooltip_Windows_11.json

@ -545,20 +545,6 @@
}
}
},
{
"Region": "UI & Personalization",
"Function": "PreventTeamsInstallation",
"Arg": {
"Zero": {
"Tag": "Enable",
"ToolTip": "Скрыть кнопку чата (Microsoft Teams) с панели задач и запретить установку Microsoft Teams для новых пользователей."
},
"One": {
"Tag": "Disable",
"ToolTip": "Отобразить кнопку чата (Microsoft Teams) на панели задач и убрать блокировку на устанвоку Microsoft Teams для новых пользователей (значение по умолчанию)."
}
}
},
{
"Region": "UI & Personalization",
"Function": "SecondsInSystemClock",

62
src/Sophia_Script_for_Windows_10/Module/Sophia.psm1

@ -9884,9 +9884,10 @@ function UninstallPCHealthCheck
#>
function InstallVCRedist
{
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
try
{
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
$Parameters = @{
Uri = "https://aka.ms/vs/17/release/VC_redist.x86.exe"
OutFile = "$DownloadsFolder\VC_redist.x86.exe"
@ -9894,9 +9895,24 @@ function InstallVCRedist
Verbose = $true
}
Invoke-WebRequest @Parameters
}
catch [System.Net.WebException]
{
Write-Warning -Message ($Localization.NoResponse -f "https://download.visualstudio.microsoft.com")
Write-Error -Message ($Localization.NoResponse -f "https://download.visualstudio.microsoft.com") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
}
Start-Process -FilePath "$DownloadsFolder\VC_redist.x86.exe" -ArgumentList "/install /passive /norestart" -Wait
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message "Visual C++ Redistributable x86" -Verbose
Start-Process -FilePath "$DownloadsFolder\VC_redist.x86.exe" -ArgumentList "/install /passive /norestart" -Wait
try
{
$Parameters = @{
Uri = "https://aka.ms/vs/17/release/VC_redist.x64.exe"
OutFile = "$DownloadsFolder\VC_redist.x64.exe"
@ -9904,18 +9920,6 @@ function InstallVCRedist
Verbose = $true
}
Invoke-WebRequest @Parameters
Start-Process -FilePath "$DownloadsFolder\VC_redist.x64.exe" -ArgumentList "/install /passive /norestart" -Wait
# PowerShell 5.1 (7.5 too) interprets 8.3 file name literally, if an environment variable contains a non-Latin word
# https://github.com/PowerShell/PowerShell/issues/21070
$Paths = @(
"$DownloadsFolder\VC_redist.x86.exe",
"$DownloadsFolder\VC_redist.x64.exe",
"$env:TEMP\dd_vcredist_x86_*.log",
"$env:TEMP\dd_vcredist_amd64_*.log"
)
Get-ChildItem -Path $Paths -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction Ignore
}
catch [System.Net.WebException]
{
@ -9923,7 +9927,24 @@ function InstallVCRedist
Write-Error -Message ($Localization.NoResponse -f "https://download.visualstudio.microsoft.com") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
}
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message "Visual C++ Redistributable x64" -Verbose
Start-Process -FilePath "$DownloadsFolder\VC_redist.x64.exe" -ArgumentList "/install /passive /norestart" -Wait
# PowerShell 5.1 (7.5 too) interprets 8.3 file name literally, if an environment variable contains a non-Latin word
# https://github.com/PowerShell/PowerShell/issues/21070
$Paths = @(
"$DownloadsFolder\VC_redist.x86.exe",
"$DownloadsFolder\VC_redist.x64.exe",
"$env:TEMP\dd_vcredist_x86_*.log",
"$env:TEMP\dd_vcredist_amd64_*.log"
)
Get-ChildItem -Path $Paths -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction Ignore
}
<#
@ -9953,6 +9974,8 @@ function InstallDotNetRuntimes
$Runtimes
)
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
foreach ($Runtime in $Runtimes)
{
switch ($Runtime)
@ -9969,7 +9992,6 @@ function InstallDotNetRuntimes
UseBasicParsing = $true
}
$LatestRelease = (Invoke-RestMethod @Parameters)."latest-release"
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
}
catch [System.Net.WebException]
{
@ -10002,6 +10024,9 @@ function InstallDotNetRuntimes
return
}
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ".NET $LatestRelease" -Verbose
Start-Process -FilePath "$DownloadsFolder\dotnet-runtime-$LatestRelease-win-x64.exe" -ArgumentList "/install /passive /norestart" -Wait
# PowerShell 5.1 (7.5 too) interprets 8.3 file name literally, if an environment variable contains a non-Latin word
@ -10024,7 +10049,6 @@ function InstallDotNetRuntimes
UseBasicParsing = $true
}
$LatestRelease = (Invoke-RestMethod @Parameters)."latest-release"
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
}
catch [System.Net.WebException]
{
@ -10057,6 +10081,9 @@ function InstallDotNetRuntimes
return
}
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ".NET $LatestRelease" -Verbose
Start-Process -FilePath "$DownloadsFolder\dotnet-runtime-$LatestRelease-win-x64.exe" -ArgumentList "/install /passive /norestart" -Wait
# PowerShell 5.1 (7.5 too) interprets 8.3 file name literally, if an environment variable contains a non-Latin word
@ -14969,6 +14996,9 @@ public static void PostMessage()
}
}
# Open Startup page
Start-Process -FilePath "ms-settings:startupapps"
# Check whether any of scheduled tasks were created. Unless open Task Scheduler
if ($Script:ScheduledTasks)
{

62
src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1

@ -8077,9 +8077,10 @@ function Import-Associations
#>
function InstallVCRedist
{
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
try
{
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
$Parameters = @{
Uri = "https://aka.ms/vs/17/release/VC_redist.x86.exe"
OutFile = "$DownloadsFolder\VC_redist.x86.exe"
@ -8087,9 +8088,24 @@ function InstallVCRedist
Verbose = $true
}
Invoke-WebRequest @Parameters
}
catch [System.Net.WebException]
{
Write-Warning -Message ($Localization.NoResponse -f "https://download.visualstudio.microsoft.com")
Write-Error -Message ($Localization.NoResponse -f "https://download.visualstudio.microsoft.com") -ErrorAction SilentlyContinue
Start-Process -FilePath "$DownloadsFolder\VC_redist.x86.exe" -ArgumentList "/install /passive /norestart" -Wait
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
}
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message "Visual C++ Redistributable x86" -Verbose
Start-Process -FilePath "$DownloadsFolder\VC_redist.x86.exe" -ArgumentList "/install /passive /norestart" -Wait
try
{
$Parameters = @{
Uri = "https://aka.ms/vs/17/release/VC_redist.x64.exe"
OutFile = "$DownloadsFolder\VC_redist.x64.exe"
@ -8097,18 +8113,6 @@ function InstallVCRedist
Verbose = $true
}
Invoke-WebRequest @Parameters
Start-Process -FilePath "$DownloadsFolder\VC_redist.x64.exe" -ArgumentList "/install /passive /norestart" -Wait
# PowerShell 5.1 (7.5 too) interprets 8.3 file name literally, if an environment variable contains a non-Latin word
# https://github.com/PowerShell/PowerShell/issues/21070
$Paths = @(
"$DownloadsFolder\VC_redist.x86.exe",
"$DownloadsFolder\VC_redist.x64.exe",
"$env:TEMP\dd_vcredist_x86_*.log",
"$env:TEMP\dd_vcredist_amd64_*.log"
)
Get-ChildItem -Path $Paths -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction Ignore
}
catch [System.Net.WebException]
{
@ -8116,7 +8120,24 @@ function InstallVCRedist
Write-Error -Message ($Localization.NoResponse -f "https://download.visualstudio.microsoft.com") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
}
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message "Visual C++ Redistributable x64" -Verbose
Start-Process -FilePath "$DownloadsFolder\VC_redist.x64.exe" -ArgumentList "/install /passive /norestart" -Wait
# PowerShell 5.1 (7.5 too) interprets 8.3 file name literally, if an environment variable contains a non-Latin word
# https://github.com/PowerShell/PowerShell/issues/21070
$Paths = @(
"$DownloadsFolder\VC_redist.x86.exe",
"$DownloadsFolder\VC_redist.x64.exe",
"$env:TEMP\dd_vcredist_x86_*.log",
"$env:TEMP\dd_vcredist_amd64_*.log"
)
Get-ChildItem -Path $Paths -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction Ignore
}
<#
@ -8146,6 +8167,8 @@ function InstallDotNetRuntimes
$Runtimes
)
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
foreach ($Runtime in $Runtimes)
{
switch ($Runtime)
@ -8162,7 +8185,6 @@ function InstallDotNetRuntimes
UseBasicParsing = $true
}
$LatestRelease = (Invoke-RestMethod @Parameters)."latest-release"
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
}
catch [System.Net.WebException]
{
@ -8195,6 +8217,9 @@ function InstallDotNetRuntimes
return
}
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ".NET $LatestRelease" -Verbose
Start-Process -FilePath "$DownloadsFolder\dotnet-runtime-$LatestRelease-win-x64.exe" -ArgumentList "/install /passive /norestart" -Wait
# PowerShell 5.1 (7.5 too) interprets 8.3 file name literally, if an environment variable contains a non-Latin word
@ -8217,7 +8242,6 @@ function InstallDotNetRuntimes
UseBasicParsing = $true
}
$LatestRelease = (Invoke-RestMethod @Parameters)."latest-release"
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
}
catch [System.Net.WebException]
{
@ -8250,6 +8274,9 @@ function InstallDotNetRuntimes
return
}
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ".NET $LatestRelease" -Verbose
Start-Process -FilePath "$DownloadsFolder\dotnet-runtime-$LatestRelease-win-x64.exe" -ArgumentList "/install /passive /norestart" -Wait
# PowerShell 5.1 (7.5 too) interprets 8.3 file name literally, if an environment variable contains a non-Latin word
@ -11509,6 +11536,9 @@ public static void PostMessage()
}
}
# Open Startup page
Start-Process -FilePath "ms-settings:startupapps"
# Check whether any of scheduled tasks were created. Unless open Task Scheduler
if ($Script:ScheduledTasks)
{

62
src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1

@ -8708,9 +8708,10 @@ function Import-Associations
#>
function InstallVCRedist
{
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
try
{
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
$Parameters = @{
Uri = "https://aka.ms/vs/17/release/VC_redist.x86.exe"
OutFile = "$DownloadsFolder\VC_redist.x86.exe"
@ -8718,9 +8719,24 @@ function InstallVCRedist
Verbose = $true
}
Invoke-WebRequest @Parameters
}
catch [System.Net.WebException]
{
Write-Warning -Message ($Localization.NoResponse -f "https://download.visualstudio.microsoft.com")
Write-Error -Message ($Localization.NoResponse -f "https://download.visualstudio.microsoft.com") -ErrorAction SilentlyContinue
Start-Process -FilePath "$DownloadsFolder\VC_redist.x86.exe" -ArgumentList "/install /passive /norestart" -Wait
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
}
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message "Visual C++ Redistributable x86" -Verbose
Start-Process -FilePath "$DownloadsFolder\VC_redist.x86.exe" -ArgumentList "/install /passive /norestart" -Wait
try
{
$Parameters = @{
Uri = "https://aka.ms/vs/17/release/VC_redist.x64.exe"
OutFile = "$DownloadsFolder\VC_redist.x64.exe"
@ -8728,18 +8744,6 @@ function InstallVCRedist
Verbose = $true
}
Invoke-WebRequest @Parameters
Start-Process -FilePath "$DownloadsFolder\VC_redist.x64.exe" -ArgumentList "/install /passive /norestart" -Wait
# PowerShell 5.1 (7.5 too) interprets 8.3 file name literally, if an environment variable contains a non-Latin word
# https://github.com/PowerShell/PowerShell/issues/21070
$Paths = @(
"$DownloadsFolder\VC_redist.x86.exe",
"$DownloadsFolder\VC_redist.x64.exe",
"$env:TEMP\dd_vcredist_x86_*.log",
"$env:TEMP\dd_vcredist_amd64_*.log"
)
Get-ChildItem -Path $Paths -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction Ignore
}
catch [System.Net.WebException]
{
@ -8747,7 +8751,24 @@ function InstallVCRedist
Write-Error -Message ($Localization.NoResponse -f "https://download.visualstudio.microsoft.com") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
}
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message "Visual C++ Redistributable x64" -Verbose
Start-Process -FilePath "$DownloadsFolder\VC_redist.x64.exe" -ArgumentList "/install /passive /norestart" -Wait
# PowerShell 5.1 (7.5 too) interprets 8.3 file name literally, if an environment variable contains a non-Latin word
# https://github.com/PowerShell/PowerShell/issues/21070
$Paths = @(
"$DownloadsFolder\VC_redist.x86.exe",
"$DownloadsFolder\VC_redist.x64.exe",
"$env:TEMP\dd_vcredist_x86_*.log",
"$env:TEMP\dd_vcredist_amd64_*.log"
)
Get-ChildItem -Path $Paths -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction Ignore
}
<#
@ -8777,6 +8798,8 @@ function InstallDotNetRuntimes
$Runtimes
)
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
foreach ($Runtime in $Runtimes)
{
switch ($Runtime)
@ -8793,7 +8816,6 @@ function InstallDotNetRuntimes
UseBasicParsing = $true
}
$LatestRelease = (Invoke-RestMethod @Parameters)."latest-release"
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
}
catch [System.Net.WebException]
{
@ -8826,6 +8848,9 @@ function InstallDotNetRuntimes
return
}
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ".NET $LatestRelease" -Verbose
Start-Process -FilePath "$DownloadsFolder\dotnet-runtime-$LatestRelease-win-x64.exe" -ArgumentList "/install /passive /norestart" -Wait
# PowerShell 5.1 (7.5 too) interprets 8.3 file name literally, if an environment variable contains a non-Latin word
@ -8848,7 +8873,6 @@ function InstallDotNetRuntimes
UseBasicParsing = $true
}
$LatestRelease = (Invoke-RestMethod @Parameters)."latest-release"
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
}
catch [System.Net.WebException]
{
@ -8881,6 +8905,9 @@ function InstallDotNetRuntimes
return
}
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ".NET $LatestRelease" -Verbose
Start-Process -FilePath "$DownloadsFolder\dotnet-runtime-$LatestRelease-win-x64.exe" -ArgumentList "/install /passive /norestart" -Wait
# PowerShell 5.1 (7.5 too) interprets 8.3 file name literally, if an environment variable contains a non-Latin word
@ -12859,6 +12886,9 @@ public static void PostMessage()
}
}
# Open Startup page
Start-Process -FilePath "ms-settings:startupapps"
# Check whether any of scheduled tasks were created. Unless open Task Scheduler
if ($Script:ScheduledTasks)
{

62
src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1

@ -9890,9 +9890,10 @@ function UninstallPCHealthCheck
#>
function InstallVCRedist
{
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
try
{
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
$Parameters = @{
Uri = "https://aka.ms/vs/17/release/VC_redist.x86.exe"
OutFile = "$DownloadsFolder\VC_redist.x86.exe"
@ -9900,9 +9901,24 @@ function InstallVCRedist
Verbose = $true
}
Invoke-WebRequest @Parameters
}
catch [System.Net.WebException]
{
Write-Warning -Message ($Localization.NoResponse -f "https://download.visualstudio.microsoft.com")
Write-Error -Message ($Localization.NoResponse -f "https://download.visualstudio.microsoft.com") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
}
Start-Process -FilePath "$DownloadsFolder\VC_redist.x86.exe" -ArgumentList "/install /passive /norestart" -Wait
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message "Visual C++ Redistributable x86" -Verbose
Start-Process -FilePath "$DownloadsFolder\VC_redist.x86.exe" -ArgumentList "/install /passive /norestart" -Wait
try
{
$Parameters = @{
Uri = "https://aka.ms/vs/17/release/VC_redist.x64.exe"
OutFile = "$DownloadsFolder\VC_redist.x64.exe"
@ -9910,18 +9926,6 @@ function InstallVCRedist
Verbose = $true
}
Invoke-WebRequest @Parameters
Start-Process -FilePath "$DownloadsFolder\VC_redist.x64.exe" -ArgumentList "/install /passive /norestart" -Wait
# PowerShell 5.1 (7.5 too) interprets 8.3 file name literally, if an environment variable contains a non-Latin word
# https://github.com/PowerShell/PowerShell/issues/21070
$Paths = @(
"$DownloadsFolder\VC_redist.x86.exe",
"$DownloadsFolder\VC_redist.x64.exe",
"$env:TEMP\dd_vcredist_x86_*.log",
"$env:TEMP\dd_vcredist_amd64_*.log"
)
Get-ChildItem -Path $Paths -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction Ignore
}
catch [System.Net.WebException]
{
@ -9929,7 +9933,24 @@ function InstallVCRedist
Write-Error -Message ($Localization.NoResponse -f "https://download.visualstudio.microsoft.com") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
}
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message "Visual C++ Redistributable x64" -Verbose
Start-Process -FilePath "$DownloadsFolder\VC_redist.x64.exe" -ArgumentList "/install /passive /norestart" -Wait
# PowerShell 5.1 (7.5 too) interprets 8.3 file name literally, if an environment variable contains a non-Latin word
# https://github.com/PowerShell/PowerShell/issues/21070
$Paths = @(
"$DownloadsFolder\VC_redist.x86.exe",
"$DownloadsFolder\VC_redist.x64.exe",
"$env:TEMP\dd_vcredist_x86_*.log",
"$env:TEMP\dd_vcredist_amd64_*.log"
)
Get-ChildItem -Path $Paths -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction Ignore
}
<#
@ -9959,6 +9980,8 @@ function InstallDotNetRuntimes
$Runtimes
)
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
foreach ($Runtime in $Runtimes)
{
switch ($Runtime)
@ -9975,7 +9998,6 @@ function InstallDotNetRuntimes
UseBasicParsing = $true
}
$LatestRelease = (Invoke-RestMethod @Parameters)."latest-release"
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
}
catch [System.Net.WebException]
{
@ -10008,6 +10030,9 @@ function InstallDotNetRuntimes
return
}
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ".NET $LatestRelease" -Verbose
Start-Process -FilePath "$DownloadsFolder\dotnet-runtime-$LatestRelease-win-x64.exe" -ArgumentList "/install /passive /norestart" -Wait
# PowerShell 5.1 (7.5 too) interprets 8.3 file name literally, if an environment variable contains a non-Latin word
@ -10030,7 +10055,6 @@ function InstallDotNetRuntimes
UseBasicParsing = $true
}
$LatestRelease = (Invoke-RestMethod @Parameters)."latest-release"
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
}
catch [System.Net.WebException]
{
@ -10063,6 +10087,9 @@ function InstallDotNetRuntimes
return
}
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ".NET $LatestRelease" -Verbose
Start-Process -FilePath "$DownloadsFolder\dotnet-runtime-$LatestRelease-win-x64.exe" -ArgumentList "/install /passive /norestart" -Wait
# PowerShell 5.1 (7.5 too) interprets 8.3 file name literally, if an environment variable contains a non-Latin word
@ -14985,6 +15012,9 @@ public static void PostMessage()
}
}
# Open Startup page
Start-Process -FilePath "ms-settings:startupapps"
# Check whether any of scheduled tasks were created. Unless open Task Scheduler
if ($Script:ScheduledTasks)
{

133
src/Sophia_Script_for_Windows_11/Module/Sophia.psm1

@ -3407,77 +3407,6 @@ function TaskViewButton
}
}
<#
.SYNOPSIS
Chat (Microsoft Teams) installation for new users
.PARAMETER Enable
Hide the Chat icon (Microsoft Teams) on the taskbar and prevent Microsoft Teams from installing for new users
.PARAMETER Disable
Show the Chat icon (Microsoft Teams) on the taskbar and remove block from installing Microsoft Teams for new users
.EXAMPLE
PreventTeamsInstallation -Enable
.EXAMPLE
PreventTeamsInstallation -Disable
.NOTES
Current user
#>
function PreventTeamsInstallation
{
param
(
[Parameter(
Mandatory = $true,
ParameterSetName = "Enable"
)]
[switch]
$Enable,
[Parameter(
Mandatory = $true,
ParameterSetName = "Disable"
)]
[switch]
$Disable
)
Clear-Variable -Name Task -ErrorAction Ignore
switch ($PSCmdlet.ParameterSetName)
{
"Disable"
{
# Save string to run it as "NT SERVICE\TrustedInstaller"
# Prevent Microsoft Teams from installing for new users
$Task = "New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Communications -Name ConfigureChatAutoInstall -Value 0 -Type Dword -Force"
}
"Enable"
{
# Save string to run it as "NT SERVICE\TrustedInstaller"
# Remove block from installing Microsoft Teams for new users
$Task = "Remove-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Communications -Name ConfigureChatAutoInstall -Value 1 -Type Dword -Force"
}
}
# Create a Scheduled Task to run it as "NT SERVICE\TrustedInstaller"
$Parameters = @{
TaskName = "BlockTeamsInstallation"
Action = New-ScheduledTaskAction -Execute powershell.exe -Argument "-WindowStyle Hidden -Command $Task"
}
Register-ScheduledTask @Parameters -Force
$ScheduleService = New-Object -ComObject Schedule.Service
$ScheduleService.Connect()
$ScheduleService.GetFolder("\").GetTask("BlockTeamsInstallation").RunEx($null, 0, 0, "NT SERVICE\TrustedInstaller")
# Remove temporary task
Unregister-ScheduledTask -TaskName BlockTeamsInstallation -Confirm:$false
}
<#
.SYNOPSIS
Seconds on the taskbar clock
@ -9496,9 +9425,10 @@ function DefaultTerminalApp
#>
function InstallVCRedist
{
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
try
{
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
$Parameters = @{
Uri = "https://aka.ms/vs/17/release/VC_redist.x86.exe"
OutFile = "$DownloadsFolder\VC_redist.x86.exe"
@ -9506,9 +9436,24 @@ function InstallVCRedist
Verbose = $true
}
Invoke-WebRequest @Parameters
}
catch [System.Net.WebException]
{
Write-Warning -Message ($Localization.NoResponse -f "https://download.visualstudio.microsoft.com")
Write-Error -Message ($Localization.NoResponse -f "https://download.visualstudio.microsoft.com") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
}
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message "Visual C++ Redistributable x86" -Verbose
Start-Process -FilePath "$DownloadsFolder\VC_redist.x86.exe" -ArgumentList "/install /passive /norestart" -Wait
Start-Process -FilePath "$DownloadsFolder\VC_redist.x86.exe" -ArgumentList "/install /passive /norestart" -Wait
try
{
$Parameters = @{
Uri = "https://aka.ms/vs/17/release/VC_redist.x64.exe"
OutFile = "$DownloadsFolder\VC_redist.x64.exe"
@ -9516,18 +9461,6 @@ function InstallVCRedist
Verbose = $true
}
Invoke-WebRequest @Parameters
Start-Process -FilePath "$DownloadsFolder\VC_redist.x64.exe" -ArgumentList "/install /passive /norestart" -Wait
# PowerShell 5.1 (7.5 too) interprets 8.3 file name literally, if an environment variable contains a non-Latin word
# https://github.com/PowerShell/PowerShell/issues/21070
$Paths = @(
"$DownloadsFolder\VC_redist.x86.exe",
"$DownloadsFolder\VC_redist.x64.exe",
"$env:TEMP\dd_vcredist_x86_*.log",
"$env:TEMP\dd_vcredist_amd64_*.log"
)
Get-ChildItem -Path $Paths -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction Ignore
}
catch [System.Net.WebException]
{
@ -9535,7 +9468,24 @@ function InstallVCRedist
Write-Error -Message ($Localization.NoResponse -f "https://download.visualstudio.microsoft.com") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
}
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message "Visual C++ Redistributable x64" -Verbose
Start-Process -FilePath "$DownloadsFolder\VC_redist.x64.exe" -ArgumentList "/install /passive /norestart" -Wait
# PowerShell 5.1 (7.5 too) interprets 8.3 file name literally, if an environment variable contains a non-Latin word
# https://github.com/PowerShell/PowerShell/issues/21070
$Paths = @(
"$DownloadsFolder\VC_redist.x86.exe",
"$DownloadsFolder\VC_redist.x64.exe",
"$env:TEMP\dd_vcredist_x86_*.log",
"$env:TEMP\dd_vcredist_amd64_*.log"
)
Get-ChildItem -Path $Paths -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction Ignore
}
<#
@ -9565,6 +9515,8 @@ function InstallDotNetRuntimes
$Runtimes
)
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
foreach ($Runtime in $Runtimes)
{
switch ($Runtime)
@ -9581,7 +9533,6 @@ function InstallDotNetRuntimes
UseBasicParsing = $true
}
$LatestRelease = (Invoke-RestMethod @Parameters)."latest-release"
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
}
catch [System.Net.WebException]
{
@ -9614,6 +9565,9 @@ function InstallDotNetRuntimes
return
}
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ".NET $LatestRelease" -Verbose
Start-Process -FilePath "$DownloadsFolder\dotnet-runtime-$LatestRelease-win-x64.exe" -ArgumentList "/install /passive /norestart" -Wait
# PowerShell 5.1 (7.5 too) interprets 8.3 file name literally, if an environment variable contains a non-Latin word
@ -9636,7 +9590,6 @@ function InstallDotNetRuntimes
UseBasicParsing = $true
}
$LatestRelease = (Invoke-RestMethod @Parameters)."latest-release"
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
}
catch [System.Net.WebException]
{
@ -9669,6 +9622,9 @@ function InstallDotNetRuntimes
return
}
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ".NET $LatestRelease" -Verbose
Start-Process -FilePath "$DownloadsFolder\dotnet-runtime-$LatestRelease-win-x64.exe" -ArgumentList "/install /passive /norestart" -Wait
# PowerShell 5.1 (7.5 too) interprets 8.3 file name literally, if an environment variable contains a non-Latin word
@ -14024,6 +13980,9 @@ public static void PostMessage()
}
}
# Open Startup page
Start-Process -FilePath "ms-settings:startupapps"
# Check whether any of scheduled tasks were created. Unless open Task Scheduler
if ($Script:ScheduledTasks)
{

8
src/Sophia_Script_for_Windows_11/Sophia.ps1

@ -469,14 +469,6 @@ TaskViewButton -Hide
# Отобразить кнопку "Представление задач" на панели задач (значение по умолчанию)
# TaskViewButton -Show
# Hide the Chat icon (Microsoft Teams) on the taskbar and prevent Microsoft Teams from installing for new users
# Скрыть кнопку чата (Microsoft Teams) с панели задач и запретить установку Microsoft Teams для новых пользователей
PreventTeamsInstallation -Enable
# Show the Chat icon (Microsoft Teams) on the taskbar and remove block from installing Microsoft Teams for new users (default value)
# Отобразить кнопку чата (Microsoft Teams) на панели задач и убрать блокировку на устанвоку Microsoft Teams для новых пользователей (значение по умолчанию)
# PreventTeamsInstallation -Disable
# Show seconds on the taskbar clock
# Показывать секунды на часах на панели задач
SecondsInSystemClock -Show

62
src/Sophia_Script_for_Windows_11_LTSC_2024/Module/Sophia.psm1

@ -8975,9 +8975,10 @@ function Import-Associations
#>
function InstallVCRedist
{
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
try
{
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
$Parameters = @{
Uri = "https://aka.ms/vs/17/release/VC_redist.x86.exe"
OutFile = "$DownloadsFolder\VC_redist.x86.exe"
@ -8985,9 +8986,24 @@ function InstallVCRedist
Verbose = $true
}
Invoke-WebRequest @Parameters
}
catch [System.Net.WebException]
{
Write-Warning -Message ($Localization.NoResponse -f "https://download.visualstudio.microsoft.com")
Write-Error -Message ($Localization.NoResponse -f "https://download.visualstudio.microsoft.com") -ErrorAction SilentlyContinue
Start-Process -FilePath "$DownloadsFolder\VC_redist.x86.exe" -ArgumentList "/install /passive /norestart" -Wait
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
}
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message "Visual C++ Redistributable x86" -Verbose
Start-Process -FilePath "$DownloadsFolder\VC_redist.x86.exe" -ArgumentList "/install /passive /norestart" -Wait
try
{
$Parameters = @{
Uri = "https://aka.ms/vs/17/release/VC_redist.x64.exe"
OutFile = "$DownloadsFolder\VC_redist.x64.exe"
@ -8995,18 +9011,6 @@ function InstallVCRedist
Verbose = $true
}
Invoke-WebRequest @Parameters
Start-Process -FilePath "$DownloadsFolder\VC_redist.x64.exe" -ArgumentList "/install /passive /norestart" -Wait
# PowerShell 5.1 (7.5 too) interprets 8.3 file name literally, if an environment variable contains a non-Latin word
# https://github.com/PowerShell/PowerShell/issues/21070
$Paths = @(
"$DownloadsFolder\VC_redist.x86.exe",
"$DownloadsFolder\VC_redist.x64.exe",
"$env:TEMP\dd_vcredist_x86_*.log",
"$env:TEMP\dd_vcredist_amd64_*.log"
)
Get-ChildItem -Path $Paths -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction Ignore
}
catch [System.Net.WebException]
{
@ -9014,7 +9018,24 @@ function InstallVCRedist
Write-Error -Message ($Localization.NoResponse -f "https://download.visualstudio.microsoft.com") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
}
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message "Visual C++ Redistributable x64" -Verbose
Start-Process -FilePath "$DownloadsFolder\VC_redist.x64.exe" -ArgumentList "/install /passive /norestart" -Wait
# PowerShell 5.1 (7.5 too) interprets 8.3 file name literally, if an environment variable contains a non-Latin word
# https://github.com/PowerShell/PowerShell/issues/21070
$Paths = @(
"$DownloadsFolder\VC_redist.x86.exe",
"$DownloadsFolder\VC_redist.x64.exe",
"$env:TEMP\dd_vcredist_x86_*.log",
"$env:TEMP\dd_vcredist_amd64_*.log"
)
Get-ChildItem -Path $Paths -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction Ignore
}
<#
@ -9044,6 +9065,8 @@ function InstallDotNetRuntimes
$Runtimes
)
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
foreach ($Runtime in $Runtimes)
{
switch ($Runtime)
@ -9060,7 +9083,6 @@ function InstallDotNetRuntimes
UseBasicParsing = $true
}
$LatestRelease = (Invoke-RestMethod @Parameters)."latest-release"
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
}
catch [System.Net.WebException]
{
@ -9093,6 +9115,9 @@ function InstallDotNetRuntimes
return
}
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ".NET $LatestRelease" -Verbose
Start-Process -FilePath "$DownloadsFolder\dotnet-runtime-$LatestRelease-win-x64.exe" -ArgumentList "/install /passive /norestart" -Wait
# PowerShell 5.1 (7.5 too) interprets 8.3 file name literally, if an environment variable contains a non-Latin word
@ -9115,7 +9140,6 @@ function InstallDotNetRuntimes
UseBasicParsing = $true
}
$LatestRelease = (Invoke-RestMethod @Parameters)."latest-release"
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
}
catch [System.Net.WebException]
{
@ -9148,6 +9172,9 @@ function InstallDotNetRuntimes
return
}
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ".NET $LatestRelease" -Verbose
Start-Process -FilePath "$DownloadsFolder\dotnet-runtime-$LatestRelease-win-x64.exe" -ArgumentList "/install /passive /norestart" -Wait
# PowerShell 5.1 (7.5 too) interprets 8.3 file name literally, if an environment variable contains a non-Latin word
@ -12894,6 +12921,9 @@ public static void PostMessage()
}
}
# Open Startup page
Start-Process -FilePath "ms-settings:startupapps"
# Check whether any of scheduled tasks were created. Unless open Task Scheduler
if ($Script:ScheduledTasks)
{

133
src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1

@ -3411,77 +3411,6 @@ function TaskViewButton
}
}
<#
.SYNOPSIS
Chat (Microsoft Teams) installation for new users
.PARAMETER Enable
Hide the Chat icon (Microsoft Teams) on the taskbar and prevent Microsoft Teams from installing for new users
.PARAMETER Disable
Show the Chat icon (Microsoft Teams) on the taskbar and remove block from installing Microsoft Teams for new users
.EXAMPLE
PreventTeamsInstallation -Enable
.EXAMPLE
PreventTeamsInstallation -Disable
.NOTES
Current user
#>
function PreventTeamsInstallation
{
param
(
[Parameter(
Mandatory = $true,
ParameterSetName = "Enable"
)]
[switch]
$Enable,
[Parameter(
Mandatory = $true,
ParameterSetName = "Disable"
)]
[switch]
$Disable
)
Clear-Variable -Name Task -ErrorAction Ignore
switch ($PSCmdlet.ParameterSetName)
{
"Disable"
{
# Save string to run it as "NT SERVICE\TrustedInstaller"
# Prevent Microsoft Teams from installing for new users
$Task = "New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Communications -Name ConfigureChatAutoInstall -Value 0 -Type Dword -Force"
}
"Enable"
{
# Save string to run it as "NT SERVICE\TrustedInstaller"
# Remove block from installing Microsoft Teams for new users
$Task = "Remove-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Communications -Name ConfigureChatAutoInstall -Value 1 -Type Dword -Force"
}
}
# Create a Scheduled Task to run it as "NT SERVICE\TrustedInstaller"
$Parameters = @{
TaskName = "BlockTeamsInstallation"
Action = New-ScheduledTaskAction -Execute powershell.exe -Argument "-WindowStyle Hidden -Command $Task"
}
Register-ScheduledTask @Parameters -Force
$ScheduleService = New-Object -ComObject Schedule.Service
$ScheduleService.Connect()
$ScheduleService.GetFolder("\").GetTask("BlockTeamsInstallation").RunEx($null, 0, 0, "NT SERVICE\TrustedInstaller")
# Remove temporary task
Unregister-ScheduledTask -TaskName BlockTeamsInstallation -Confirm:$false
}
<#
.SYNOPSIS
Seconds on the taskbar clock
@ -9502,9 +9431,10 @@ function DefaultTerminalApp
#>
function InstallVCRedist
{
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
try
{
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
$Parameters = @{
Uri = "https://aka.ms/vs/17/release/VC_redist.x86.exe"
OutFile = "$DownloadsFolder\VC_redist.x86.exe"
@ -9512,9 +9442,24 @@ function InstallVCRedist
Verbose = $true
}
Invoke-WebRequest @Parameters
}
catch [System.Net.WebException]
{
Write-Warning -Message ($Localization.NoResponse -f "https://download.visualstudio.microsoft.com")
Write-Error -Message ($Localization.NoResponse -f "https://download.visualstudio.microsoft.com") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
}
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message "Visual C++ Redistributable x86" -Verbose
Start-Process -FilePath "$DownloadsFolder\VC_redist.x86.exe" -ArgumentList "/install /passive /norestart" -Wait
Start-Process -FilePath "$DownloadsFolder\VC_redist.x86.exe" -ArgumentList "/install /passive /norestart" -Wait
try
{
$Parameters = @{
Uri = "https://aka.ms/vs/17/release/VC_redist.x64.exe"
OutFile = "$DownloadsFolder\VC_redist.x64.exe"
@ -9522,18 +9467,6 @@ function InstallVCRedist
Verbose = $true
}
Invoke-WebRequest @Parameters
Start-Process -FilePath "$DownloadsFolder\VC_redist.x64.exe" -ArgumentList "/install /passive /norestart" -Wait
# PowerShell 5.1 (7.5 too) interprets 8.3 file name literally, if an environment variable contains a non-Latin word
# https://github.com/PowerShell/PowerShell/issues/21070
$Paths = @(
"$DownloadsFolder\VC_redist.x86.exe",
"$DownloadsFolder\VC_redist.x64.exe",
"$env:TEMP\dd_vcredist_x86_*.log",
"$env:TEMP\dd_vcredist_amd64_*.log"
)
Get-ChildItem -Path $Paths -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction Ignore
}
catch [System.Net.WebException]
{
@ -9541,7 +9474,24 @@ function InstallVCRedist
Write-Error -Message ($Localization.NoResponse -f "https://download.visualstudio.microsoft.com") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
}
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message "Visual C++ Redistributable x64" -Verbose
Start-Process -FilePath "$DownloadsFolder\VC_redist.x64.exe" -ArgumentList "/install /passive /norestart" -Wait
# PowerShell 5.1 (7.5 too) interprets 8.3 file name literally, if an environment variable contains a non-Latin word
# https://github.com/PowerShell/PowerShell/issues/21070
$Paths = @(
"$DownloadsFolder\VC_redist.x86.exe",
"$DownloadsFolder\VC_redist.x64.exe",
"$env:TEMP\dd_vcredist_x86_*.log",
"$env:TEMP\dd_vcredist_amd64_*.log"
)
Get-ChildItem -Path $Paths -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction Ignore
}
<#
@ -9571,6 +9521,8 @@ function InstallDotNetRuntimes
$Runtimes
)
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
foreach ($Runtime in $Runtimes)
{
switch ($Runtime)
@ -9587,7 +9539,6 @@ function InstallDotNetRuntimes
UseBasicParsing = $true
}
$LatestRelease = (Invoke-RestMethod @Parameters)."latest-release"
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
}
catch [System.Net.WebException]
{
@ -9620,6 +9571,9 @@ function InstallDotNetRuntimes
return
}
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ".NET $LatestRelease" -Verbose
Start-Process -FilePath "$DownloadsFolder\dotnet-runtime-$LatestRelease-win-x64.exe" -ArgumentList "/install /passive /norestart" -Wait
# PowerShell 5.1 (7.5 too) interprets 8.3 file name literally, if an environment variable contains a non-Latin word
@ -9642,7 +9596,6 @@ function InstallDotNetRuntimes
UseBasicParsing = $true
}
$LatestRelease = (Invoke-RestMethod @Parameters)."latest-release"
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
}
catch [System.Net.WebException]
{
@ -9675,6 +9628,9 @@ function InstallDotNetRuntimes
return
}
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ".NET $LatestRelease" -Verbose
Start-Process -FilePath "$DownloadsFolder\dotnet-runtime-$LatestRelease-win-x64.exe" -ArgumentList "/install /passive /norestart" -Wait
# PowerShell 5.1 (7.5 too) interprets 8.3 file name literally, if an environment variable contains a non-Latin word
@ -14040,6 +13996,9 @@ public static void PostMessage()
}
}
# Open Startup page
Start-Process -FilePath "ms-settings:startupapps"
# Check whether any of scheduled tasks were created. Unless open Task Scheduler
if ($Script:ScheduledTasks)
{

8
src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1

@ -473,14 +473,6 @@ TaskViewButton -Hide
# Отобразить кнопку "Представление задач" на панели задач (значение по умолчанию)
# TaskViewButton -Show
# Hide the Chat icon (Microsoft Teams) on the taskbar and prevent Microsoft Teams from installing for new users
# Скрыть кнопку чата (Microsoft Teams) с панели задач и запретить установку Microsoft Teams для новых пользователей
PreventTeamsInstallation -Enable
# Show the Chat icon (Microsoft Teams) on the taskbar and remove block from installing Microsoft Teams for new users (default value)
# Отобразить кнопку чата (Microsoft Teams) на панели задач и убрать блокировку на устанвоку Microsoft Teams для новых пользователей (значение по умолчанию)
# PreventTeamsInstallation -Disable
# Show seconds on the taskbar clock
# Показывать секунды на часах на панели задач
SecondsInSystemClock -Show

Loading…
Cancel
Save