Browse Source

Removed `PreventTeamsInstallation` function for `Windows 11`

master
Dmitry Nefedov 3 weeks 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. 52
      src/Sophia_Script_for_Windows_10/Module/Sophia.psm1
  6. 52
      src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1
  7. 52
      src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1
  8. 52
      src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1
  9. 123
      src/Sophia_Script_for_Windows_11/Module/Sophia.psm1
  10. 8
      src/Sophia_Script_for_Windows_11/Sophia.ps1
  11. 52
      src/Sophia_Script_for_Windows_11_LTSC_2024/Module/Sophia.psm1
  12. 123
      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", "Preset": "Zero",
"WindowsDefault": "One" "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", "Region": "UI & Personalization",
"Control": "cmb", "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", "Region": "UI & Personalization",
"Function": "SecondsInSystemClock", "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", "Region": "UI & Personalization",
"Function": "SecondsInSystemClock", "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", "Region": "UI & Personalization",
"Function": "SecondsInSystemClock", "Function": "SecondsInSystemClock",

52
src/Sophia_Script_for_Windows_10/Module/Sophia.psm1

@ -9884,9 +9884,10 @@ function UninstallPCHealthCheck
#> #>
function InstallVCRedist function InstallVCRedist
{ {
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
try try
{ {
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
$Parameters = @{ $Parameters = @{
Uri = "https://aka.ms/vs/17/release/VC_redist.x86.exe" Uri = "https://aka.ms/vs/17/release/VC_redist.x86.exe"
OutFile = "$DownloadsFolder\VC_redist.x86.exe" OutFile = "$DownloadsFolder\VC_redist.x86.exe"
@ -9894,9 +9895,24 @@ function InstallVCRedist
Verbose = $true Verbose = $true
} }
Invoke-WebRequest @Parameters 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 = @{ $Parameters = @{
Uri = "https://aka.ms/vs/17/release/VC_redist.x64.exe" Uri = "https://aka.ms/vs/17/release/VC_redist.x64.exe"
OutFile = "$DownloadsFolder\VC_redist.x64.exe" OutFile = "$DownloadsFolder\VC_redist.x64.exe"
@ -9904,6 +9920,19 @@ function InstallVCRedist
Verbose = $true Verbose = $true
} }
Invoke-WebRequest @Parameters 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 x64" -Verbose
Start-Process -FilePath "$DownloadsFolder\VC_redist.x64.exe" -ArgumentList "/install /passive /norestart" -Wait Start-Process -FilePath "$DownloadsFolder\VC_redist.x64.exe" -ArgumentList "/install /passive /norestart" -Wait
@ -9917,14 +9946,6 @@ function InstallVCRedist
) )
Get-ChildItem -Path $Paths -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction Ignore Get-ChildItem -Path $Paths -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction Ignore
} }
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
}
}
<# <#
.SYNOPSIS .SYNOPSIS
@ -9953,6 +9974,8 @@ function InstallDotNetRuntimes
$Runtimes $Runtimes
) )
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
foreach ($Runtime in $Runtimes) foreach ($Runtime in $Runtimes)
{ {
switch ($Runtime) switch ($Runtime)
@ -9969,7 +9992,6 @@ function InstallDotNetRuntimes
UseBasicParsing = $true UseBasicParsing = $true
} }
$LatestRelease = (Invoke-RestMethod @Parameters)."latest-release" $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] catch [System.Net.WebException]
{ {
@ -10002,6 +10024,9 @@ function InstallDotNetRuntimes
return 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 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 # 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 UseBasicParsing = $true
} }
$LatestRelease = (Invoke-RestMethod @Parameters)."latest-release" $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] catch [System.Net.WebException]
{ {
@ -10057,6 +10081,9 @@ function InstallDotNetRuntimes
return 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 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 # 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 # Check whether any of scheduled tasks were created. Unless open Task Scheduler
if ($Script:ScheduledTasks) if ($Script:ScheduledTasks)
{ {

52
src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1

@ -8077,9 +8077,10 @@ function Import-Associations
#> #>
function InstallVCRedist function InstallVCRedist
{ {
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
try try
{ {
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
$Parameters = @{ $Parameters = @{
Uri = "https://aka.ms/vs/17/release/VC_redist.x86.exe" Uri = "https://aka.ms/vs/17/release/VC_redist.x86.exe"
OutFile = "$DownloadsFolder\VC_redist.x86.exe" OutFile = "$DownloadsFolder\VC_redist.x86.exe"
@ -8087,9 +8088,24 @@ function InstallVCRedist
Verbose = $true Verbose = $true
} }
Invoke-WebRequest @Parameters 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 = @{ $Parameters = @{
Uri = "https://aka.ms/vs/17/release/VC_redist.x64.exe" Uri = "https://aka.ms/vs/17/release/VC_redist.x64.exe"
OutFile = "$DownloadsFolder\VC_redist.x64.exe" OutFile = "$DownloadsFolder\VC_redist.x64.exe"
@ -8097,6 +8113,19 @@ function InstallVCRedist
Verbose = $true Verbose = $true
} }
Invoke-WebRequest @Parameters 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 x64" -Verbose
Start-Process -FilePath "$DownloadsFolder\VC_redist.x64.exe" -ArgumentList "/install /passive /norestart" -Wait Start-Process -FilePath "$DownloadsFolder\VC_redist.x64.exe" -ArgumentList "/install /passive /norestart" -Wait
@ -8110,14 +8139,6 @@ function InstallVCRedist
) )
Get-ChildItem -Path $Paths -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction Ignore Get-ChildItem -Path $Paths -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction Ignore
} }
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
}
}
<# <#
.SYNOPSIS .SYNOPSIS
@ -8146,6 +8167,8 @@ function InstallDotNetRuntimes
$Runtimes $Runtimes
) )
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
foreach ($Runtime in $Runtimes) foreach ($Runtime in $Runtimes)
{ {
switch ($Runtime) switch ($Runtime)
@ -8162,7 +8185,6 @@ function InstallDotNetRuntimes
UseBasicParsing = $true UseBasicParsing = $true
} }
$LatestRelease = (Invoke-RestMethod @Parameters)."latest-release" $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] catch [System.Net.WebException]
{ {
@ -8195,6 +8217,9 @@ function InstallDotNetRuntimes
return 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 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 # 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 UseBasicParsing = $true
} }
$LatestRelease = (Invoke-RestMethod @Parameters)."latest-release" $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] catch [System.Net.WebException]
{ {
@ -8250,6 +8274,9 @@ function InstallDotNetRuntimes
return 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 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 # 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 # Check whether any of scheduled tasks were created. Unless open Task Scheduler
if ($Script:ScheduledTasks) if ($Script:ScheduledTasks)
{ {

52
src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1

@ -8708,9 +8708,10 @@ function Import-Associations
#> #>
function InstallVCRedist function InstallVCRedist
{ {
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
try try
{ {
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
$Parameters = @{ $Parameters = @{
Uri = "https://aka.ms/vs/17/release/VC_redist.x86.exe" Uri = "https://aka.ms/vs/17/release/VC_redist.x86.exe"
OutFile = "$DownloadsFolder\VC_redist.x86.exe" OutFile = "$DownloadsFolder\VC_redist.x86.exe"
@ -8718,9 +8719,24 @@ function InstallVCRedist
Verbose = $true Verbose = $true
} }
Invoke-WebRequest @Parameters 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 = @{ $Parameters = @{
Uri = "https://aka.ms/vs/17/release/VC_redist.x64.exe" Uri = "https://aka.ms/vs/17/release/VC_redist.x64.exe"
OutFile = "$DownloadsFolder\VC_redist.x64.exe" OutFile = "$DownloadsFolder\VC_redist.x64.exe"
@ -8728,6 +8744,19 @@ function InstallVCRedist
Verbose = $true Verbose = $true
} }
Invoke-WebRequest @Parameters 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 x64" -Verbose
Start-Process -FilePath "$DownloadsFolder\VC_redist.x64.exe" -ArgumentList "/install /passive /norestart" -Wait Start-Process -FilePath "$DownloadsFolder\VC_redist.x64.exe" -ArgumentList "/install /passive /norestart" -Wait
@ -8741,14 +8770,6 @@ function InstallVCRedist
) )
Get-ChildItem -Path $Paths -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction Ignore Get-ChildItem -Path $Paths -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction Ignore
} }
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
}
}
<# <#
.SYNOPSIS .SYNOPSIS
@ -8777,6 +8798,8 @@ function InstallDotNetRuntimes
$Runtimes $Runtimes
) )
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
foreach ($Runtime in $Runtimes) foreach ($Runtime in $Runtimes)
{ {
switch ($Runtime) switch ($Runtime)
@ -8793,7 +8816,6 @@ function InstallDotNetRuntimes
UseBasicParsing = $true UseBasicParsing = $true
} }
$LatestRelease = (Invoke-RestMethod @Parameters)."latest-release" $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] catch [System.Net.WebException]
{ {
@ -8826,6 +8848,9 @@ function InstallDotNetRuntimes
return 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 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 # 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 UseBasicParsing = $true
} }
$LatestRelease = (Invoke-RestMethod @Parameters)."latest-release" $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] catch [System.Net.WebException]
{ {
@ -8881,6 +8905,9 @@ function InstallDotNetRuntimes
return 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 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 # 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 # Check whether any of scheduled tasks were created. Unless open Task Scheduler
if ($Script:ScheduledTasks) if ($Script:ScheduledTasks)
{ {

52
src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1

@ -9890,9 +9890,10 @@ function UninstallPCHealthCheck
#> #>
function InstallVCRedist function InstallVCRedist
{ {
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
try try
{ {
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
$Parameters = @{ $Parameters = @{
Uri = "https://aka.ms/vs/17/release/VC_redist.x86.exe" Uri = "https://aka.ms/vs/17/release/VC_redist.x86.exe"
OutFile = "$DownloadsFolder\VC_redist.x86.exe" OutFile = "$DownloadsFolder\VC_redist.x86.exe"
@ -9900,9 +9901,24 @@ function InstallVCRedist
Verbose = $true Verbose = $true
} }
Invoke-WebRequest @Parameters 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 = @{ $Parameters = @{
Uri = "https://aka.ms/vs/17/release/VC_redist.x64.exe" Uri = "https://aka.ms/vs/17/release/VC_redist.x64.exe"
OutFile = "$DownloadsFolder\VC_redist.x64.exe" OutFile = "$DownloadsFolder\VC_redist.x64.exe"
@ -9910,6 +9926,19 @@ function InstallVCRedist
Verbose = $true Verbose = $true
} }
Invoke-WebRequest @Parameters 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 x64" -Verbose
Start-Process -FilePath "$DownloadsFolder\VC_redist.x64.exe" -ArgumentList "/install /passive /norestart" -Wait Start-Process -FilePath "$DownloadsFolder\VC_redist.x64.exe" -ArgumentList "/install /passive /norestart" -Wait
@ -9923,14 +9952,6 @@ function InstallVCRedist
) )
Get-ChildItem -Path $Paths -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction Ignore Get-ChildItem -Path $Paths -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction Ignore
} }
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
}
}
<# <#
.SYNOPSIS .SYNOPSIS
@ -9959,6 +9980,8 @@ function InstallDotNetRuntimes
$Runtimes $Runtimes
) )
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
foreach ($Runtime in $Runtimes) foreach ($Runtime in $Runtimes)
{ {
switch ($Runtime) switch ($Runtime)
@ -9975,7 +9998,6 @@ function InstallDotNetRuntimes
UseBasicParsing = $true UseBasicParsing = $true
} }
$LatestRelease = (Invoke-RestMethod @Parameters)."latest-release" $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] catch [System.Net.WebException]
{ {
@ -10008,6 +10030,9 @@ function InstallDotNetRuntimes
return 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 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 # 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 UseBasicParsing = $true
} }
$LatestRelease = (Invoke-RestMethod @Parameters)."latest-release" $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] catch [System.Net.WebException]
{ {
@ -10063,6 +10087,9 @@ function InstallDotNetRuntimes
return 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 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 # 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 # Check whether any of scheduled tasks were created. Unless open Task Scheduler
if ($Script:ScheduledTasks) if ($Script:ScheduledTasks)
{ {

123
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 .SYNOPSIS
Seconds on the taskbar clock Seconds on the taskbar clock
@ -9496,9 +9425,10 @@ function DefaultTerminalApp
#> #>
function InstallVCRedist function InstallVCRedist
{ {
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
try try
{ {
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
$Parameters = @{ $Parameters = @{
Uri = "https://aka.ms/vs/17/release/VC_redist.x86.exe" Uri = "https://aka.ms/vs/17/release/VC_redist.x86.exe"
OutFile = "$DownloadsFolder\VC_redist.x86.exe" OutFile = "$DownloadsFolder\VC_redist.x86.exe"
@ -9506,9 +9436,24 @@ function InstallVCRedist
Verbose = $true Verbose = $true
} }
Invoke-WebRequest @Parameters 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 = @{ $Parameters = @{
Uri = "https://aka.ms/vs/17/release/VC_redist.x64.exe" Uri = "https://aka.ms/vs/17/release/VC_redist.x64.exe"
OutFile = "$DownloadsFolder\VC_redist.x64.exe" OutFile = "$DownloadsFolder\VC_redist.x64.exe"
@ -9516,6 +9461,19 @@ function InstallVCRedist
Verbose = $true Verbose = $true
} }
Invoke-WebRequest @Parameters 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 x64" -Verbose
Start-Process -FilePath "$DownloadsFolder\VC_redist.x64.exe" -ArgumentList "/install /passive /norestart" -Wait Start-Process -FilePath "$DownloadsFolder\VC_redist.x64.exe" -ArgumentList "/install /passive /norestart" -Wait
@ -9529,14 +9487,6 @@ function InstallVCRedist
) )
Get-ChildItem -Path $Paths -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction Ignore Get-ChildItem -Path $Paths -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction Ignore
} }
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
}
}
<# <#
.SYNOPSIS .SYNOPSIS
@ -9565,6 +9515,8 @@ function InstallDotNetRuntimes
$Runtimes $Runtimes
) )
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
foreach ($Runtime in $Runtimes) foreach ($Runtime in $Runtimes)
{ {
switch ($Runtime) switch ($Runtime)
@ -9581,7 +9533,6 @@ function InstallDotNetRuntimes
UseBasicParsing = $true UseBasicParsing = $true
} }
$LatestRelease = (Invoke-RestMethod @Parameters)."latest-release" $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] catch [System.Net.WebException]
{ {
@ -9614,6 +9565,9 @@ function InstallDotNetRuntimes
return 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 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 # 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 UseBasicParsing = $true
} }
$LatestRelease = (Invoke-RestMethod @Parameters)."latest-release" $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] catch [System.Net.WebException]
{ {
@ -9669,6 +9622,9 @@ function InstallDotNetRuntimes
return 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 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 # 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 # Check whether any of scheduled tasks were created. Unless open Task Scheduler
if ($Script:ScheduledTasks) if ($Script:ScheduledTasks)
{ {

8
src/Sophia_Script_for_Windows_11/Sophia.ps1

@ -469,14 +469,6 @@ TaskViewButton -Hide
# Отобразить кнопку "Представление задач" на панели задач (значение по умолчанию) # Отобразить кнопку "Представление задач" на панели задач (значение по умолчанию)
# TaskViewButton -Show # 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 # Show seconds on the taskbar clock
# Показывать секунды на часах на панели задач # Показывать секунды на часах на панели задач
SecondsInSystemClock -Show SecondsInSystemClock -Show

52
src/Sophia_Script_for_Windows_11_LTSC_2024/Module/Sophia.psm1

@ -8975,9 +8975,10 @@ function Import-Associations
#> #>
function InstallVCRedist function InstallVCRedist
{ {
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
try try
{ {
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
$Parameters = @{ $Parameters = @{
Uri = "https://aka.ms/vs/17/release/VC_redist.x86.exe" Uri = "https://aka.ms/vs/17/release/VC_redist.x86.exe"
OutFile = "$DownloadsFolder\VC_redist.x86.exe" OutFile = "$DownloadsFolder\VC_redist.x86.exe"
@ -8985,9 +8986,24 @@ function InstallVCRedist
Verbose = $true Verbose = $true
} }
Invoke-WebRequest @Parameters 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 = @{ $Parameters = @{
Uri = "https://aka.ms/vs/17/release/VC_redist.x64.exe" Uri = "https://aka.ms/vs/17/release/VC_redist.x64.exe"
OutFile = "$DownloadsFolder\VC_redist.x64.exe" OutFile = "$DownloadsFolder\VC_redist.x64.exe"
@ -8995,6 +9011,19 @@ function InstallVCRedist
Verbose = $true Verbose = $true
} }
Invoke-WebRequest @Parameters 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 x64" -Verbose
Start-Process -FilePath "$DownloadsFolder\VC_redist.x64.exe" -ArgumentList "/install /passive /norestart" -Wait Start-Process -FilePath "$DownloadsFolder\VC_redist.x64.exe" -ArgumentList "/install /passive /norestart" -Wait
@ -9008,14 +9037,6 @@ function InstallVCRedist
) )
Get-ChildItem -Path $Paths -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction Ignore Get-ChildItem -Path $Paths -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction Ignore
} }
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
}
}
<# <#
.SYNOPSIS .SYNOPSIS
@ -9044,6 +9065,8 @@ function InstallDotNetRuntimes
$Runtimes $Runtimes
) )
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
foreach ($Runtime in $Runtimes) foreach ($Runtime in $Runtimes)
{ {
switch ($Runtime) switch ($Runtime)
@ -9060,7 +9083,6 @@ function InstallDotNetRuntimes
UseBasicParsing = $true UseBasicParsing = $true
} }
$LatestRelease = (Invoke-RestMethod @Parameters)."latest-release" $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] catch [System.Net.WebException]
{ {
@ -9093,6 +9115,9 @@ function InstallDotNetRuntimes
return 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 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 # 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 UseBasicParsing = $true
} }
$LatestRelease = (Invoke-RestMethod @Parameters)."latest-release" $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] catch [System.Net.WebException]
{ {
@ -9148,6 +9172,9 @@ function InstallDotNetRuntimes
return 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 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 # 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 # Check whether any of scheduled tasks were created. Unless open Task Scheduler
if ($Script:ScheduledTasks) if ($Script:ScheduledTasks)
{ {

123
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 .SYNOPSIS
Seconds on the taskbar clock Seconds on the taskbar clock
@ -9502,9 +9431,10 @@ function DefaultTerminalApp
#> #>
function InstallVCRedist function InstallVCRedist
{ {
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
try try
{ {
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
$Parameters = @{ $Parameters = @{
Uri = "https://aka.ms/vs/17/release/VC_redist.x86.exe" Uri = "https://aka.ms/vs/17/release/VC_redist.x86.exe"
OutFile = "$DownloadsFolder\VC_redist.x86.exe" OutFile = "$DownloadsFolder\VC_redist.x86.exe"
@ -9512,9 +9442,24 @@ function InstallVCRedist
Verbose = $true Verbose = $true
} }
Invoke-WebRequest @Parameters 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 = @{ $Parameters = @{
Uri = "https://aka.ms/vs/17/release/VC_redist.x64.exe" Uri = "https://aka.ms/vs/17/release/VC_redist.x64.exe"
OutFile = "$DownloadsFolder\VC_redist.x64.exe" OutFile = "$DownloadsFolder\VC_redist.x64.exe"
@ -9522,6 +9467,19 @@ function InstallVCRedist
Verbose = $true Verbose = $true
} }
Invoke-WebRequest @Parameters 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 x64" -Verbose
Start-Process -FilePath "$DownloadsFolder\VC_redist.x64.exe" -ArgumentList "/install /passive /norestart" -Wait Start-Process -FilePath "$DownloadsFolder\VC_redist.x64.exe" -ArgumentList "/install /passive /norestart" -Wait
@ -9535,14 +9493,6 @@ function InstallVCRedist
) )
Get-ChildItem -Path $Paths -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction Ignore Get-ChildItem -Path $Paths -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction Ignore
} }
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
}
}
<# <#
.SYNOPSIS .SYNOPSIS
@ -9571,6 +9521,8 @@ function InstallDotNetRuntimes
$Runtimes $Runtimes
) )
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
foreach ($Runtime in $Runtimes) foreach ($Runtime in $Runtimes)
{ {
switch ($Runtime) switch ($Runtime)
@ -9587,7 +9539,6 @@ function InstallDotNetRuntimes
UseBasicParsing = $true UseBasicParsing = $true
} }
$LatestRelease = (Invoke-RestMethod @Parameters)."latest-release" $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] catch [System.Net.WebException]
{ {
@ -9620,6 +9571,9 @@ function InstallDotNetRuntimes
return 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 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 # 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 UseBasicParsing = $true
} }
$LatestRelease = (Invoke-RestMethod @Parameters)."latest-release" $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] catch [System.Net.WebException]
{ {
@ -9675,6 +9628,9 @@ function InstallDotNetRuntimes
return 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 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 # 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 # Check whether any of scheduled tasks were created. Unless open Task Scheduler
if ($Script:ScheduledTasks) if ($Script:ScheduledTasks)
{ {

8
src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1

@ -473,14 +473,6 @@ TaskViewButton -Hide
# Отобразить кнопку "Представление задач" на панели задач (значение по умолчанию) # Отобразить кнопку "Представление задач" на панели задач (значение по умолчанию)
# TaskViewButton -Show # 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 # Show seconds on the taskbar clock
# Показывать секунды на часах на панели задач # Показывать секунды на часах на панели задач
SecondsInSystemClock -Show SecondsInSystemClock -Show

Loading…
Cancel
Save