From 8fd992d4da734d549c58e59d3b5ea62a4dca84a8 Mon Sep 17 00:00:00 2001 From: Dmitry Nefedov Date: Sun, 8 Oct 2023 18:43:43 +0300 Subject: [PATCH] Small improvements --- Wrapper/Config/config_Windows_11.json | 67 ++++- .../de-DE/tooltip_Windows_11.json | 70 +++-- .../en-US/tooltip_Windows_11.json | 69 +++-- .../ru-RU/tooltip_Windows_11.json | 74 +++-- .../Module/Sophia.psm1 | 29 +- .../Module/Sophia.psm1 | 22 +- .../Module/Sophia.psm1 | 11 +- .../Module/Sophia.psm1 | 29 +- .../Module/Sophia.psm1 | 282 ++++++++++++++---- src/Sophia_Script_for_Windows_11/Sophia.ps1 | 20 ++ .../Module/Sophia.psm1 | 282 ++++++++++++++---- .../Sophia.ps1 | 20 ++ 12 files changed, 711 insertions(+), 264 deletions(-) diff --git a/Wrapper/Config/config_Windows_11.json b/Wrapper/Config/config_Windows_11.json index 5369e009..9f003823 100644 --- a/Wrapper/Config/config_Windows_11.json +++ b/Wrapper/Config/config_Windows_11.json @@ -599,7 +599,7 @@ "Region": "UI & Personalization", "Control": "cmb", "Required": "false", - "Function": "TaskViewButton", + "Function": "CopilotButton", "Arg": { "Zero": { "Tag": "Hide" @@ -616,7 +616,7 @@ "Region": "UI & Personalization", "Control": "cmb", "Required": "false", - "Function": "TaskbarChat", + "Function": "TaskViewButton", "Arg": { "Zero": { "Tag": "Hide" @@ -633,6 +633,23 @@ "Region": "UI & Personalization", "Control": "cmb", "Required": "false", + "Function": "TaskbarChat", + "Arg": { + "Zero": { + "Tag": "Hide" + }, + "One": { + "Tag": "Show" + } + }, + "Preset": "Zero", + "WindowsDefault": "One" + }, + { + "Id": 319, + "Region": "UI & Personalization", + "Control": "cmb", + "Required": "false", "Function": "SecondsInSystemClock", "Arg": { "Zero": { @@ -646,7 +663,27 @@ "WindowsDefault": "One" }, { - "Id": 319, + "Id": 320, + "Region": "UI & Personalization", + "Control": "cmb", + "Required": "false", + "Function": "TaskbarCombine", + "Arg": { + "Zero": { + "Tag": "Always" + }, + "One": { + "Tag": "Full" + }, + "Two": { + "Tag": "Never" + } + }, + "Preset": "Zero", + "WindowsDefault": "Zero" + }, + { + "Id": 321, "Region": "UI & Personalization", "Control": "chk", "Required": "false", @@ -663,7 +700,7 @@ "WindowsDefault": "" }, { - "Id": 320, + "Id": 322, "Region": "UI & Personalization", "Control": "cmb", "Required": "false", @@ -683,7 +720,7 @@ "WindowsDefault": "Two" }, { - "Id": 321, + "Id": 323, "Region": "UI & Personalization", "Control": "cmb", "Required": "false", @@ -700,7 +737,7 @@ "WindowsDefault": "One" }, { - "Id": 322, + "Id": 324, "Region": "UI & Personalization", "Control": "cmb", "Required": "false", @@ -717,7 +754,7 @@ "WindowsDefault": "One" }, { - "Id": 323, + "Id": 325, "Region": "UI & Personalization", "Control": "cmb", "Required": "false", @@ -734,7 +771,7 @@ "WindowsDefault": "One" }, { - "Id": 324, + "Id": 326, "Region": "UI & Personalization", "Control": "cmb", "Required": "false", @@ -751,7 +788,7 @@ "WindowsDefault": "One" }, { - "Id": 325, + "Id": 327, "Region": "UI & Personalization", "Control": "cmb", "Required": "false", @@ -768,7 +805,7 @@ "WindowsDefault": "One" }, { - "Id": 326, + "Id": 328, "Region": "UI & Personalization", "Control": "cmb", "Required": "false", @@ -785,7 +822,7 @@ "WindowsDefault": "One" }, { - "Id": 327, + "Id": 329, "Region": "UI & Personalization", "Control": "cmb", "Required": "false", @@ -802,7 +839,7 @@ "WindowsDefault": "One" }, { - "Id": 328, + "Id": 330, "Region": "UI & Personalization", "Control": "cmb", "Required": "false", @@ -819,7 +856,7 @@ "WindowsDefault": "One" }, { - "Id": 329, + "Id": 331, "Region": "UI & Personalization", "Control": "cmb", "Required": "false", @@ -839,7 +876,7 @@ "WindowsDefault": "Zero" }, { - "Id": 330, + "Id": 332, "Region": "UI & Personalization", "Control": "cmb", "Required": "false", @@ -856,7 +893,7 @@ "WindowsDefault": "One" }, { - "Id": 331, + "Id": 333, "Region": "UI & Personalization", "Control": "cmb", "Required": "false", diff --git a/Wrapper/Localizations/de-DE/tooltip_Windows_11.json b/Wrapper/Localizations/de-DE/tooltip_Windows_11.json index 3fab49a7..70c7c766 100644 --- a/Wrapper/Localizations/de-DE/tooltip_Windows_11.json +++ b/Wrapper/Localizations/de-DE/tooltip_Windows_11.json @@ -527,6 +527,21 @@ { "Id": 316, "Region": "UI & Personalization", + "Function": "CopilotButton", + "Arg": { + "Zero": { + "Tag": "Hide", + "ToolTip": "Ausblenden der Schaltfläche Copilot in der Taskleiste." + }, + "One": { + "Tag": "Show", + "ToolTip": "Zeigen Sie die Schaltfläche "Copilot" in der Taskleiste an (Standardeinstellung)." + } + } + }, + { + "Id": 317, + "Region": "UI & Personalization", "Function": "TaskViewButton", "Arg": { "Zero": { @@ -540,7 +555,7 @@ } }, { - "Id": 317, + "Id": 318, "Region": "UI & Personalization", "Function": "TaskbarChat", "Arg": { @@ -555,7 +570,7 @@ } }, { - "Id": 318, + "Id": 319, "Region": "UI & Personalization", "Function": "SecondsInSystemClock", "Arg": { @@ -570,7 +585,26 @@ } }, { - "Id": 319, + "Id": 320, + "Region": "UI & Personalization", + "Function": "TaskbarCombine", + "Arg": { + "Zero": { + "Tag": "Always", + "ToolTip": "Kombinieren Sie Schaltflächen in der Taskleiste und blenden Sie Beschriftungen immer aus. (default value)." + }, + "One": { + "Tag": "Full", + "ToolTip": "Taskleistenschaltflächen zusammenfassen und Beschriftungen ausblenden, wenn die Taskleiste voll ist.." + }, + "Two": { + "Tag": "Never", + "ToolTip": "Kombinieren Sie die Schaltflächen der Taskleiste und blenden Sie die Beschriftungen nicht aus.." + } + } + }, + { + "Id": 321, "Region": "UI & Personalization", "Function": "UnpinTaskbarShortcuts -Shortcuts", "ToolTip":"Entfernt die Verknüpfungen \"Microsoft Edge\" oder \"Microsoft Store\" von der Taskleiste", @@ -586,7 +620,7 @@ } }, { - "Id": 320, + "Id": 322, "Region": "UI & Personalization", "Function": "ControlPanelView", "Arg": { @@ -605,7 +639,7 @@ } }, { - "Id": 321, + "Id": 323, "Region": "UI & Personalization", "Function": "WindowsColorMode", "Arg": { @@ -620,7 +654,7 @@ } }, { - "Id": 322, + "Id": 324, "Region": "UI & Personalization", "Function": "AppColorMode", "Arg": { @@ -635,7 +669,7 @@ } }, { - "Id": 323, + "Id": 325, "Region": "UI & Personalization", "Function": "FirstLogonAnimation", "Arg": { @@ -650,7 +684,7 @@ } }, { - "Id": 324, + "Id": 326, "Region": "UI & Personalization", "Function": "JPEGWallpapersQuality", "Arg": { @@ -665,7 +699,7 @@ } }, { - "Id": 325, + "Id": 327, "Region": "UI & Personalization", "Function": "ShortcutsSuffix", "Arg": { @@ -680,7 +714,7 @@ } }, { - "Id": 326, + "Id": 328, "Region": "UI & Personalization", "Function": "PrtScnSnippingTool", "Arg": { @@ -695,7 +729,7 @@ } }, { - "Id": 327, + "Id": 329, "Region": "UI & Personalization", "Function": "AppsLanguageSwitch", "Arg": { @@ -710,7 +744,7 @@ } }, { - "Id": 328, + "Id": 330, "Region": "UI & Personalization", "Function": "AeroShaking", "Arg": { @@ -725,7 +759,7 @@ } }, { - "Id": 329, + "Id": 331, "Region": "UI & Personalization", "Function": "Cursors", "Arg": { @@ -744,7 +778,7 @@ } }, { - "Id": 330, + "Id": 332, "Region": "UI & Personalization", "Function": "FolderGroupBy", "Arg": { @@ -759,7 +793,7 @@ } }, { - "Id": 331, + "Id": 333, "Region": "UI & Personalization", "Function": "NavigationPaneExpand", "Arg": { @@ -1520,7 +1554,7 @@ "ToolTip": "Pfad zum Symbol." } } - }, + }, { "Id": 600, "Region": "WSL", @@ -2148,8 +2182,8 @@ "ToolTip": "Menüoption \"In Windows Terminal öffnen\" im Kontextmenü von Ordnern ausblenden." }, "One": { - "Tag": "Show", - "ToolTip": "Menüoption \"In Windows Terminal öffnen\" im Kontextmenü der Ordner anzeigen (Standardeinstellung)." + "Tag": "Show", + "ToolTip": "Menüoption \"In Windows Terminal öffnen\" im Kontextmenü der Ordner anzeigen (Standardeinstellung)." } } }, diff --git a/Wrapper/Localizations/en-US/tooltip_Windows_11.json b/Wrapper/Localizations/en-US/tooltip_Windows_11.json index bb64c2b6..aa8c2de1 100644 --- a/Wrapper/Localizations/en-US/tooltip_Windows_11.json +++ b/Wrapper/Localizations/en-US/tooltip_Windows_11.json @@ -527,6 +527,21 @@ { "Id": 316, "Region": "UI & Personalization", + "Function": "CopilotButton", + "Arg": { + "Zero": { + "Tag": "Hide", + "ToolTip": "Hide Copilot button on the taskbar." + }, + "One": { + "Tag": "Show", + "ToolTip": "Show Copilot button on the taskbar (default value)." + } + } + }, + { + "Id": 317, + "Region": "UI & Personalization", "Function": "TaskViewButton", "Arg": { "Zero": { @@ -540,7 +555,7 @@ } }, { - "Id": 317, + "Id": 318, "Region": "UI & Personalization", "Function": "TaskbarChat", "Arg": { @@ -555,7 +570,7 @@ } }, { - "Id": 318, + "Id": 319, "Region": "UI & Personalization", "Function": "SecondsInSystemClock", "Arg": { @@ -570,7 +585,26 @@ } }, { - "Id": 319, + "Id": 320, + "Region": "UI & Personalization", + "Function": "TaskbarCombine", + "Arg": { + "Zero": { + "Tag": "Always", + "ToolTip": "Combine taskbar buttons and always hide labels (default value)." + }, + "One": { + "Tag": "Full", + "ToolTip": "Combine taskbar buttons and hide labels when taskbar is full." + }, + "Two": { + "Tag": "Never", + "ToolTip": "Combine taskbar buttons and never hide labels." + } + } + }, + { + "Id": 321, "Region": "UI & Personalization", "Function": "UnpinTaskbarShortcuts -Shortcuts", "ToolTip": "Unpin the \"Microsoft Edge\" and \"Microsoft Store\" shortcuts from the taskbar", @@ -586,7 +620,7 @@ } }, { - "Id": 320, + "Id": 322, "Region": "UI & Personalization", "Function": "ControlPanelView", "Arg": { @@ -605,7 +639,7 @@ } }, { - "Id": 321, + "Id": 323, "Region": "UI & Personalization", "Function": "WindowsColorMode", "Arg": { @@ -620,7 +654,7 @@ } }, { - "Id": 322, + "Id": 324, "Region": "UI & Personalization", "Function": "AppColorMode", "Arg": { @@ -635,7 +669,7 @@ } }, { - "Id": 323, + "Id": 325, "Region": "UI & Personalization", "Function": "FirstLogonAnimation", "Arg": { @@ -650,7 +684,7 @@ } }, { - "Id": 324, + "Id": 326, "Region": "UI & Personalization", "Function": "JPEGWallpapersQuality", "Arg": { @@ -665,7 +699,7 @@ } }, { - "Id": 325, + "Id": 327, "Region": "UI & Personalization", "Function": "ShortcutsSuffix", "Arg": { @@ -680,7 +714,7 @@ } }, { - "Id": 326, + "Id": 328, "Region": "UI & Personalization", "Function": "PrtScnSnippingTool", "Arg": { @@ -695,7 +729,7 @@ } }, { - "Id": 327, + "Id": 329, "Region": "UI & Personalization", "Function": "AppsLanguageSwitch", "Arg": { @@ -710,7 +744,7 @@ } }, { - "Id": 328, + "Id": 330, "Region": "UI & Personalization", "Function": "AeroShaking", "Arg": { @@ -725,7 +759,7 @@ } }, { - "Id": 329, + "Id": 331, "Region": "UI & Personalization", "Function": "Cursors", "Arg": { @@ -744,7 +778,7 @@ } }, { - "Id": 330, + "Id": 332, "Region": "UI & Personalization", "Function": "FolderGroupBy", "Arg": { @@ -759,7 +793,7 @@ } }, { - "Id": 331, + "Id": 333, "Region": "UI & Personalization", "Function": "NavigationPaneExpand", "Arg": { @@ -1521,7 +1555,6 @@ } } }, - { "Id": 600, "Region": "WSL", @@ -2149,8 +2182,8 @@ "ToolTip": "Hide the \"Open in Windows Terminal\" item in the folders context menu." }, "One": { - "Tag": "Show", - "ToolTip": "Show the \"Open in Windows Terminal\" item in the folders context menu (default value)." + "Tag": "Show", + "ToolTip": "Show the \"Open in Windows Terminal\" item in the folders context menu (default value)." } } }, diff --git a/Wrapper/Localizations/ru-RU/tooltip_Windows_11.json b/Wrapper/Localizations/ru-RU/tooltip_Windows_11.json index 5aea748c..7f2851e6 100644 --- a/Wrapper/Localizations/ru-RU/tooltip_Windows_11.json +++ b/Wrapper/Localizations/ru-RU/tooltip_Windows_11.json @@ -527,6 +527,21 @@ { "Id": 316, "Region": "UI & Personalization", + "Function": "CopilotButton", + "Arg": { + "Zero": { + "Tag": "Hide", + "ToolTip": "Скрыть кнопку Copilot с панели задач." + }, + "One": { + "Tag": "Show", + "ToolTip": "Отобразить кнопку Copilot на панели задач (значение по умолчанию)." + } + } + }, + { + "Id": 317, + "Region": "UI & Personalization", "Function": "TaskViewButton", "Arg": { "Zero": { @@ -540,7 +555,7 @@ } }, { - "Id": 317, + "Id": 318, "Region": "UI & Personalization", "Function": "TaskbarChat", "Arg": { @@ -555,7 +570,7 @@ } }, { - "Id": 318, + "Id": 319, "Region": "UI & Personalization", "Function": "SecondsInSystemClock", "Arg": { @@ -570,7 +585,26 @@ } }, { - "Id": 319, + "Id": 320, + "Region": "UI & Personalization", + "Function": "TaskbarCombine", + "Arg": { + "Zero": { + "Tag": "Always", + "ToolTip": "Объединить кнопки панели задач и всегда скрывать метки (значение по умолчанию)." + }, + "One": { + "Tag": "Full", + "ToolTip": "Объединить кнопки панели задач и скрывать метки при переполнении панели задач." + }, + "Two": { + "Tag": "Never", + "ToolTip": "Объединить кнопки панели задач и никогда не скрывать метки." + } + } + }, + { + "Id": 321, "Region": "UI & Personalization", "Function": "UnpinTaskbarShortcuts -Shortcuts", "ToolTip": "Открепить ярлыки \"Microsoft Edge\", \"Microsoft Store\" от панели задач", @@ -586,7 +620,7 @@ } }, { - "Id": 320, + "Id": 322, "Region": "UI & Personalization", "Function": "ControlPanelView", "Arg": { @@ -605,7 +639,7 @@ } }, { - "Id": 321, + "Id": 323, "Region": "UI & Personalization", "Function": "WindowsColorMode", "Arg": { @@ -620,7 +654,7 @@ } }, { - "Id": 322, + "Id": 324, "Region": "UI & Personalization", "Function": "AppColorMode", "Arg": { @@ -635,7 +669,7 @@ } }, { - "Id": 323, + "Id": 325, "Region": "UI & Personalization", "Function": "FirstLogonAnimation", "Arg": { @@ -650,7 +684,7 @@ } }, { - "Id": 324, + "Id": 326, "Region": "UI & Personalization", "Function": "JPEGWallpapersQuality", "Arg": { @@ -665,7 +699,7 @@ } }, { - "Id": 325, + "Id": 327, "Region": "UI & Personalization", "Function": "ShortcutsSuffix", "Arg": { @@ -680,7 +714,7 @@ } }, { - "Id": 326, + "Id": 328, "Region": "UI & Personalization", "Function": "PrtScnSnippingTool", "Arg": { @@ -695,7 +729,7 @@ } }, { - "Id": 327, + "Id": 329, "Region": "UI & Personalization", "Function": "AppsLanguageSwitch", "Arg": { @@ -710,7 +744,7 @@ } }, { - "Id": 328, + "Id": 330, "Region": "UI & Personalization", "Function": "AeroShaking", "Arg": { @@ -725,7 +759,7 @@ } }, { - "Id": 329, + "Id": 331, "Region": "UI & Personalization", "Function": "Cursors", "Arg": { @@ -744,7 +778,7 @@ } }, { - "Id": 330, + "Id": 332, "Region": "UI & Personalization", "Function": "FolderGroupBy", "Arg": { @@ -759,7 +793,7 @@ } }, { - "Id": 331, + "Id": 333, "Region": "UI & Personalization", "Function": "NavigationPaneExpand", "Arg": { @@ -1520,7 +1554,7 @@ "ToolTip": "Путь до значка." } } - }, + }, { "Id": 600, "Region": "WSL", @@ -2146,11 +2180,11 @@ "Zero": { "Tag": "Show", "ToolTip": "Отобразить пункт \"Открыть в Терминале Windows\" в контекстном меню папок (значение по умолчанию)." - }, + }, "One": { - "Tag": "Hide", - "ToolTip": "Скрыть пункт \"Открыть в Терминале Windows\" в контекстном меню папок." - } + "Tag": "Show", + "ToolTip": "Show the \"Open in Windows Terminal\" item in the folders context menu (default value)." + } } }, { diff --git a/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 index 4c4ab6e3..594f6398 100644 --- a/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 @@ -209,26 +209,19 @@ public static string GetString(uint strId) # Enable receiving updates for other Microsoft products when you update Windows (New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "") - Start-Sleep -Seconds 1 - # Check for UWP apps updates Get-CimInstance -Namespace root/CIMV2/mdm/dmmap -ClassName MDM_EnterpriseModernAppManagement_AppManagement01 | Invoke-CimMethod -MethodName UpdateScanMethod - # Open the "Windows Update" page - Start-Process -FilePath "ms-settings:windowsupdate" - # Check for updates - Start-Process -FilePath "ms-settings:windowsupdate-action" + Start-Process -FilePath "$env:SystemRoot\System32\UsoClient.exe" -ArgumentList StartInteractiveScan - Start-Sleep -Seconds 1 - - # Trigger Windows Update for detecting new updates - (New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow() + # Open the "Windows Update" page + Start-Process -FilePath "ms-settings:windowsupdate" exit } } - {($_ -lt 19045) -or ($_ -gt 19048)} + {($_ -lt 19045) -or ($_ -gt 19045)} { Write-Warning -Message $Localization.UnsupportedOSBuild @@ -584,18 +577,14 @@ public static string GetString(uint strId) # Enable receiving updates for other Microsoft products when you update Windows (New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "") - Start-Sleep -Seconds 1 - - # Open the "Windows Update" page - Start-Process -FilePath "ms-settings:windowsupdate" + # Check for UWP apps updates + Get-CimInstance -Namespace root/CIMV2/mdm/dmmap -ClassName MDM_EnterpriseModernAppManagement_AppManagement01 | Invoke-CimMethod -MethodName UpdateScanMethod # Check for updates - Start-Process -FilePath "ms-settings:windowsupdate-action" + Start-Process -FilePath "$env:SystemRoot\System32\UsoClient.exe" -ArgumentList StartInteractiveScan - Start-Sleep -Seconds 1 - - # Trigger Windows Update for detecting new updates - (New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow() + # Open the "Windows Update" page + Start-Process -FilePath "ms-settings:windowsupdate" exit } diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1 index cd1abbc0..3e23c099 100644 --- a/src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1 @@ -120,19 +120,12 @@ public static string GetString(uint strId) # Enable receiving updates for other Microsoft products when you update Windows (New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "") - Start-Sleep -Seconds 1 + # Check for updates + Start-Process -FilePath "$env:SystemRoot\System32\UsoClient.exe" -ArgumentList StartInteractiveScan # Open the "Windows Update" page Start-Process -FilePath "ms-settings:windowsupdate" - # Check for updates - Start-Process -FilePath "ms-settings:windowsupdate-action" - - Start-Sleep -Seconds 1 - - # Trigger Windows Update for detecting new updates - (New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow() - exit } } @@ -459,19 +452,12 @@ public static string GetString(uint strId) # Enable receiving updates for other Microsoft products when you update Windows (New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "") - Start-Sleep -Seconds 1 + # Check for updates + Start-Process -FilePath "$env:SystemRoot\System32\UsoClient.exe" -ArgumentList StartInteractiveScan # Open the "Windows Update" page Start-Process -FilePath "ms-settings:windowsupdate" - # Check for updates - Start-Process -FilePath "ms-settings:windowsupdate-action" - - Start-Sleep -Seconds 1 - - # Trigger Windows Update for detecting new updates - (New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow() - exit } diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1 index eb3504d8..a64eaee9 100644 --- a/src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1 @@ -120,19 +120,12 @@ public static string GetString(uint strId) # Enable receiving updates for other Microsoft products when you update Windows (New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "") - Start-Sleep -Seconds 1 + # Check for updates + Start-Process -FilePath "$env:SystemRoot\System32\UsoClient.exe" -ArgumentList StartInteractiveScan # Open the "Windows Update" page Start-Process -FilePath "ms-settings:windowsupdate" - # Check for updates - Start-Process -FilePath "ms-settings:windowsupdate-action" - - Start-Sleep -Seconds 1 - - # Trigger Windows Update for detecting new updates - (New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow() - exit } } diff --git a/src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1 index 944161fd..7aff5deb 100644 --- a/src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1 @@ -205,26 +205,19 @@ public static string GetString(uint strId) # Enable receiving updates for other Microsoft products when you update Windows (New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "") - Start-Sleep -Seconds 1 - # Check for UWP apps updates Get-CimInstance -Namespace root/CIMV2/mdm/dmmap -ClassName MDM_EnterpriseModernAppManagement_AppManagement01 | Invoke-CimMethod -MethodName UpdateScanMethod - # Open the "Windows Update" page - Start-Process -FilePath "ms-settings:windowsupdate" - # Check for updates - Start-Process -FilePath "ms-settings:windowsupdate-action" + Start-Process -FilePath "$env:SystemRoot\System32\UsoClient.exe" -ArgumentList StartInteractiveScan - Start-Sleep -Seconds 1 - - # Trigger Windows Update for detecting new updates - (New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow() + # Open the "Windows Update" page + Start-Process -FilePath "ms-settings:windowsupdate" exit } } - {($_ -lt 19045) -or ($_ -gt 19048)} + {($_ -lt 19045) -or ($_ -gt 19045)} { Write-Warning -Message $Localization.UnsupportedOSBuild @@ -585,18 +578,14 @@ public static string GetString(uint strId) # Enable receiving updates for other Microsoft products when you update Windows (New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "") - Start-Sleep -Seconds 1 - - # Open the "Windows Update" page - Start-Process -FilePath "ms-settings:windowsupdate" + # Check for UWP apps updates + Get-CimInstance -Namespace root/CIMV2/mdm/dmmap -ClassName MDM_EnterpriseModernAppManagement_AppManagement01 | Invoke-CimMethod -MethodName UpdateScanMethod # Check for updates - Start-Process -FilePath "ms-settings:windowsupdate-action" + Start-Process -FilePath "$env:SystemRoot\System32\UsoClient.exe" -ArgumentList StartInteractiveScan - Start-Sleep -Seconds 1 - - # Trigger Windows Update for detecting new updates - (New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow() + # Open the "Windows Update" page + Start-Process -FilePath "ms-settings:windowsupdate" exit } diff --git a/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1 index 6318ee23..6f8d092f 100644 --- a/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1 @@ -246,6 +246,8 @@ public static string GetString(uint strId) Invoke-WebRequest @Parameters Start-Process -FilePath "$DownloadsFolder\Windows11InstallationAssistant.exe" -ArgumentList "/SkipEULA" + + exit } catch [System.Net.WebException] { @@ -270,21 +272,14 @@ public static string GetString(uint strId) # Enable receiving updates for other Microsoft products when you update Windows (New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "") - Start-Sleep -Seconds 1 - # Check for UWP apps updates Get-CimInstance -Namespace root/CIMV2/mdm/dmmap -ClassName MDM_EnterpriseModernAppManagement_AppManagement01 | Invoke-CimMethod -MethodName UpdateScanMethod - # Open the "Windows Update" page - Start-Process -FilePath "ms-settings:windowsupdate" - # Check for updates - Start-Process -FilePath "ms-settings:windowsupdate-action" - - Start-Sleep -Seconds 1 + Start-Process -FilePath "$env:SystemRoot\System32\UsoClient.exe" -ArgumentList StartInteractiveScan - # Trigger Windows Update for detecting new updates - (New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow() + # Open the "Windows Update" page + Start-Process -FilePath "ms-settings:windowsupdate" exit } @@ -305,21 +300,14 @@ public static string GetString(uint strId) # Enable receiving updates for other Microsoft products when you update Windows (New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "") - Start-Sleep -Seconds 1 - # Check for UWP apps updates Get-CimInstance -Namespace root/CIMV2/mdm/dmmap -ClassName MDM_EnterpriseModernAppManagement_AppManagement01 | Invoke-CimMethod -MethodName UpdateScanMethod - # Open the "Windows Update" page - Start-Process -FilePath "ms-settings:windowsupdate" - # Check for updates - Start-Process -FilePath "ms-settings:windowsupdate-action" + Start-Process -FilePath "$env:SystemRoot\System32\UsoClient.exe" -ArgumentList StartInteractiveScan - Start-Sleep -Seconds 1 - - # Trigger Windows Update for detecting new updates - (New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow() + # Open the "Windows Update" page + Start-Process -FilePath "ms-settings:windowsupdate" exit } @@ -648,18 +636,14 @@ public static string GetString(uint strId) # Enable receiving updates for other Microsoft products when you update Windows (New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "") - Start-Sleep -Seconds 1 - - # Open the "Windows Update" page - Start-Process -FilePath "ms-settings:windowsupdate" + # Check for UWP apps updates + Get-CimInstance -Namespace root/CIMV2/mdm/dmmap -ClassName MDM_EnterpriseModernAppManagement_AppManagement01 | Invoke-CimMethod -MethodName UpdateScanMethod # Check for updates - Start-Process -FilePath "ms-settings:windowsupdate-action" + Start-Process -FilePath "$env:SystemRoot\System32\UsoClient.exe" -ArgumentList StartInteractiveScan - Start-Sleep -Seconds 1 - - # Trigger Windows Update for detecting new updates - (New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow() + # Open the "Windows Update" page + Start-Process -FilePath "ms-settings:windowsupdate" exit } @@ -3300,6 +3284,65 @@ function TaskbarSearch } } +<# + .SYNOPSIS + Copilot button on the taskbar + + .PARAMETER Hide + Hide Copilot button on the taskbar + + .PARAMETER Show + Show Copilot button on the taskbar + + .EXAMPLE + CopilotButton -Hide + + .EXAMPLE + CopilotButton -Show + + .NOTES + Current user +#> +function CopilotButton +{ + param + ( + [Parameter( + Mandatory = $true, + ParameterSetName = "Hide" + )] + [switch] + $Hide, + + [Parameter( + Mandatory = $true, + ParameterSetName = "Show" + )] + [switch] + $Show + ) + + switch ((Get-CimInstance -ClassName CIM_OperatingSystem).BuildNumber) + { + {($_ -ne 22631) -and ($_ -lt 23493)} + { + return + } + } + + switch ($PSCmdlet.ParameterSetName) + { + "Hide" + { + New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name ShowCopilotButton -PropertyType DWord -Value 0 -Force + } + "Show" + { + New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name ShowCopilotButton -PropertyType DWord -Value 1 -Force + } + } +} + <# .SYNOPSIS Task view button on the taskbar @@ -3477,6 +3520,74 @@ function SecondsInSystemClock } } +<# + .SYNOPSIS + Combine taskbar buttons and hide labels + + .PARAMETER Always + Combine taskbar buttons and always hide labels + + .PARAMETER Full + Combine taskbar buttons and hide labels when taskbar is full + + .PARAMETER Never + Combine taskbar buttons and never hide labels + + .EXAMPLE + TaskbarCombine -Always + + .EXAMPLE + TaskbarCombine -Full + + .EXAMPLE + TaskbarCombine -Never + + .NOTES + Current user +#> +function TaskbarCombine +{ + param + ( + [Parameter( + Mandatory = $true, + ParameterSetName = "Always" + )] + [switch] + $Always, + + [Parameter( + Mandatory = $true, + ParameterSetName = "Full" + )] + [switch] + $Full, + + [Parameter( + Mandatory = $true, + ParameterSetName = "Never" + )] + [switch] + $Never + ) + + switch ($PSCmdlet.ParameterSetName) + { + "Always" + { + New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name taskbarGlomLevel -PropertyType DWord -Value 0 -Force + } + "Full" + { + New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name taskbarGlomLevel -PropertyType DWord -Value 1 -Force + } + "Never" + { + New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name taskbarGlomLevel -PropertyType DWord -Value 1 -Force + } + } +} + <# .SYNOPSIS Unpin shortcuts from the taskbar @@ -13677,6 +13788,9 @@ function WindowsSandbox .EXAMPLE DNSoverHTTPS -Enable -PrimaryDNS 1.0.0.1 -SecondaryDNS 1.1.1.1 + .EXAMPLE Enable DNS-over-HTTPS via Comss.one DNS server. Applicable for Russia only + DNSoverHTTPS -ComssOneDNS + .EXAMPLE DNSoverHTTPS -Disable @@ -13686,6 +13800,9 @@ function WindowsSandbox .LINK https://docs.microsoft.com/en-us/windows-server/networking/dns/doh-client-support + .LINK + https://www.comss.ru/page.php?id=7315 + .NOTES Machine-wide #> @@ -13719,6 +13836,14 @@ function DNSoverHTTPS [string] $SecondaryDNS, + # https://www.comss.ru/page.php?id=7315 + [Parameter( + Mandatory = $true, + ParameterSetName = "ComssOneDNS" + )] + [switch] + $ComssOneDNS, + [Parameter( Mandatory = $true, ParameterSetName = "Disable" @@ -13727,6 +13852,11 @@ function DNSoverHTTPS $Disable ) + if ((Get-CimInstance -ClassName CIM_ComputerSystem).PartOfDomain) + { + return + } + # Determining whether Hyper-V is enabled # After enabling Hyper-V feature a virtual switch breing created, so we need to use different method to isolate the proper adapter if (-not (Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent) @@ -13742,54 +13872,80 @@ function DNSoverHTTPS { "Enable" { - if (-not (Get-CimInstance -ClassName CIM_ComputerSystem).PartOfDomain) + if (((Get-WinHomeLocation).GeoId -ne "203") -or ((Get-WinHomeLocation).GeoId -ne "29")) + { + return + } + + # Set a primary and secondary DNS servers + if (-not (Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent) + { + Get-NetAdapter -Physical | Get-NetIPInterface -AddressFamily IPv4 | Set-DnsClientServerAddress -ServerAddresses $PrimaryDNS, $SecondaryDNS + } + else { - # Set a primary and secondary DNS servers - if (-not (Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent) + Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Set-DnsClientServerAddress -ServerAddresses $PrimaryDNS, $SecondaryDNS + } + + foreach ($InterfaceGuid in $InterfaceGuids) + { + if (-not (Test-Path -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$PrimaryDNS")) { - Get-NetAdapter -Physical | Get-NetIPInterface -AddressFamily IPv4 | Set-DnsClientServerAddress -ServerAddresses $PrimaryDNS, $SecondaryDNS + New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$PrimaryDNS" -Force } - else + if (-not (Test-Path -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$SecondaryDNS")) { - Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Set-DnsClientServerAddress -ServerAddresses $PrimaryDNS, $SecondaryDNS + New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$SecondaryDNS" -Force } + # Encrypted preffered, unencrypted allowed + New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$PrimaryDNS" -Name DohFlags -PropertyType QWord -Value 5 -Force + New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$SecondaryDNS" -Name DohFlags -PropertyType QWord -Value 5 -Force + } + } + "ComssOneDNS" + { + if (-not (((Get-WinHomeLocation).GeoId -eq "203") -or ((Get-WinHomeLocation).GeoId -eq "29"))) + { + return + } - foreach ($InterfaceGuid in $InterfaceGuids) + # Set a primary and secondary DNS servers + if (-not (Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent) + { + Get-NetAdapter -Physical | Get-NetIPInterface -AddressFamily IPv4 | Set-DnsClientServerAddress -ServerAddresses 92.223.65.71 + } + else + { + Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Set-DnsClientServerAddress -ServerAddresses 92.223.65.71 + } + + foreach ($InterfaceGuid in $InterfaceGuids) + { + if (-not (Test-Path -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\92.223.65.71")) { - if (-not (Test-Path -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$PrimaryDNS")) - { - New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$PrimaryDNS" -Force - } - if (-not (Test-Path -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$SecondaryDNS")) - { - New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$SecondaryDNS" -Force - } - # Encrypted preffered, unencrypted allowed - New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$PrimaryDNS" -Name DohFlags -PropertyType QWord -Value 5 -Force - New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$SecondaryDNS" -Name DohFlags -PropertyType QWord -Value 5 -Force + New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\92.223.65.71" -Force } + New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\92.223.65.71" -Name DohFlags -PropertyType QWord -Value 2 -Force + New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\92.223.65.71" -Name DohTemplate -PropertyType String -Value https://dns.comss.one/dns-query -Force } } "Disable" { - if (-not (Get-CimInstance -ClassName CIM_ComputerSystem).PartOfDomain) + # Determining whether Hyper-V is enabled + if (-not (Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent) { - # Determining whether Hyper-V is enabled - if (-not (Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent) - { - # Configure DNS servers automatically - Get-NetAdapter -Physical | Get-NetIPInterface -AddressFamily IPv4 | Set-DnsClientServerAddress -ResetServerAddresses - } - else - { - # Configure DNS servers automatically - Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Set-DnsClientServerAddress -ResetServerAddresses - } + # Configure DNS servers automatically + Get-NetAdapter -Physical | Get-NetIPInterface -AddressFamily IPv4 | Set-DnsClientServerAddress -ResetServerAddresses + } + else + { + # Configure DNS servers automatically + Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Set-DnsClientServerAddress -ResetServerAddresses + } - foreach ($InterfaceGuid in $InterfaceGuids) - { - Remove-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh" -Recurse -Force -ErrorAction Ignore - } + foreach ($InterfaceGuid in $InterfaceGuids) + { + Remove-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh" -Recurse -Force -ErrorAction Ignore } } } diff --git a/src/Sophia_Script_for_Windows_11/Sophia.ps1 b/src/Sophia_Script_for_Windows_11/Sophia.ps1 index 7dcaebf4..33e032c4 100644 --- a/src/Sophia_Script_for_Windows_11/Sophia.ps1 +++ b/src/Sophia_Script_for_Windows_11/Sophia.ps1 @@ -389,6 +389,14 @@ TaskbarSearch -Hide # Показать поле поиска на панели задач (значение по умолчанию) # TaskbarSearch -SearchBox +# Hide Copilot button on the taskbar +# Скрыть кнопку Copilot с панели задач +CopilotButton -Hide + +# Show Copilot button on the taskbar (default value) +# Отобразить кнопку Copilot на панели задач (значение по умолчанию) +# CopilotButton -Show + # Hide the Task view button from the taskbar # Скрыть кнопку "Представление задач" с панели задач TaskViewButton -Hide @@ -413,6 +421,18 @@ SecondsInSystemClock -Show # Скрыть секунды на часах на панели задач (значение по умолчанию) # SecondsInSystemClock -Hide +# Combine taskbar buttons and always hide labels (default value) +# Объединить кнопки панели задач и всегда скрывать метки (значение по умолчанию) +TaskbarCombine -Always + +# Combine taskbar buttons and hide labels when taskbar is full +# Объединить кнопки панели задач и скрывать метки при переполнении панели задач +# TaskbarCombine -Full + +# Combine taskbar buttons and never hide labels +# Объединить кнопки панели задач и никогда не скрывать метки +# TaskbarCombine -Never + # Unpin the "Microsoft Edge", "Microsoft Store" shortcuts from the taskbar # Открепить ярлыки "Microsoft Edge", "Microsoft Store" от панели задач UnpinTaskbarShortcuts -Shortcuts Edge, Store diff --git a/src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1 index 79f85b43..50f71070 100644 --- a/src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1 @@ -242,6 +242,8 @@ public static string GetString(uint strId) Invoke-WebRequest @Parameters Start-Process -FilePath "$DownloadsFolder\Windows11InstallationAssistant.exe" -ArgumentList "/SkipEULA" + + exit } catch [System.Net.WebException] { @@ -266,21 +268,14 @@ public static string GetString(uint strId) # Enable receiving updates for other Microsoft products when you update Windows (New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "") - Start-Sleep -Seconds 1 - # Check for UWP apps updates Get-CimInstance -Namespace root/CIMV2/mdm/dmmap -ClassName MDM_EnterpriseModernAppManagement_AppManagement01 | Invoke-CimMethod -MethodName UpdateScanMethod - # Open the "Windows Update" page - Start-Process -FilePath "ms-settings:windowsupdate" - # Check for updates - Start-Process -FilePath "ms-settings:windowsupdate-action" - - Start-Sleep -Seconds 1 + Start-Process -FilePath "$env:SystemRoot\System32\UsoClient.exe" -ArgumentList StartInteractiveScan - # Trigger Windows Update for detecting new updates - (New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow() + # Open the "Windows Update" page + Start-Process -FilePath "ms-settings:windowsupdate" exit } @@ -301,21 +296,14 @@ public static string GetString(uint strId) # Enable receiving updates for other Microsoft products when you update Windows (New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "") - Start-Sleep -Seconds 1 - # Check for UWP apps updates Get-CimInstance -Namespace root/CIMV2/mdm/dmmap -ClassName MDM_EnterpriseModernAppManagement_AppManagement01 | Invoke-CimMethod -MethodName UpdateScanMethod - # Open the "Windows Update" page - Start-Process -FilePath "ms-settings:windowsupdate" - # Check for updates - Start-Process -FilePath "ms-settings:windowsupdate-action" + Start-Process -FilePath "$env:SystemRoot\System32\UsoClient.exe" -ArgumentList StartInteractiveScan - Start-Sleep -Seconds 1 - - # Trigger Windows Update for detecting new updates - (New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow() + # Open the "Windows Update" page + Start-Process -FilePath "ms-settings:windowsupdate" exit } @@ -649,18 +637,14 @@ public static string GetString(uint strId) # Enable receiving updates for other Microsoft products when you update Windows (New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "") - Start-Sleep -Seconds 1 - - # Open the "Windows Update" page - Start-Process -FilePath "ms-settings:windowsupdate" + # Check for UWP apps updates + Get-CimInstance -Namespace root/CIMV2/mdm/dmmap -ClassName MDM_EnterpriseModernAppManagement_AppManagement01 | Invoke-CimMethod -MethodName UpdateScanMethod # Check for updates - Start-Process -FilePath "ms-settings:windowsupdate-action" + Start-Process -FilePath "$env:SystemRoot\System32\UsoClient.exe" -ArgumentList StartInteractiveScan - Start-Sleep -Seconds 1 - - # Trigger Windows Update for detecting new updates - (New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow() + # Open the "Windows Update" page + Start-Process -FilePath "ms-settings:windowsupdate" exit } @@ -3301,6 +3285,65 @@ function TaskbarSearch } } +<# + .SYNOPSIS + Copilot button on the taskbar + + .PARAMETER Hide + Hide Copilot button on the taskbar + + .PARAMETER Show + Show Copilot button on the taskbar + + .EXAMPLE + CopilotButton -Hide + + .EXAMPLE + CopilotButton -Show + + .NOTES + Current user +#> +function CopilotButton +{ + param + ( + [Parameter( + Mandatory = $true, + ParameterSetName = "Hide" + )] + [switch] + $Hide, + + [Parameter( + Mandatory = $true, + ParameterSetName = "Show" + )] + [switch] + $Show + ) + + switch ((Get-CimInstance -ClassName CIM_OperatingSystem).BuildNumber) + { + {($_ -ne 22631) -and ($_ -lt 23493)} + { + return + } + } + + switch ($PSCmdlet.ParameterSetName) + { + "Hide" + { + New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name ShowCopilotButton -PropertyType DWord -Value 0 -Force + } + "Show" + { + New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name ShowCopilotButton -PropertyType DWord -Value 1 -Force + } + } +} + <# .SYNOPSIS Task view button on the taskbar @@ -3478,6 +3521,74 @@ function SecondsInSystemClock } } +<# + .SYNOPSIS + Combine taskbar buttons and hide labels + + .PARAMETER Always + Combine taskbar buttons and always hide labels + + .PARAMETER Full + Combine taskbar buttons and hide labels when taskbar is full + + .PARAMETER Never + Combine taskbar buttons and never hide labels + + .EXAMPLE + TaskbarCombine -Always + + .EXAMPLE + TaskbarCombine -Full + + .EXAMPLE + TaskbarCombine -Never + + .NOTES + Current user +#> +function TaskbarCombine +{ + param + ( + [Parameter( + Mandatory = $true, + ParameterSetName = "Always" + )] + [switch] + $Always, + + [Parameter( + Mandatory = $true, + ParameterSetName = "Full" + )] + [switch] + $Full, + + [Parameter( + Mandatory = $true, + ParameterSetName = "Never" + )] + [switch] + $Never + ) + + switch ($PSCmdlet.ParameterSetName) + { + "Always" + { + New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name taskbarGlomLevel -PropertyType DWord -Value 0 -Force + } + "Full" + { + New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name taskbarGlomLevel -PropertyType DWord -Value 1 -Force + } + "Never" + { + New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name taskbarGlomLevel -PropertyType DWord -Value 1 -Force + } + } +} + <# .SYNOPSIS Unpin shortcuts from the taskbar @@ -13698,6 +13809,9 @@ function WindowsSandbox .EXAMPLE DNSoverHTTPS -Enable -PrimaryDNS 1.0.0.1 -SecondaryDNS 1.1.1.1 + .EXAMPLE Enable DNS-over-HTTPS via Comss.one DNS server. Applicable for Russia only + DNSoverHTTPS -ComssOneDNS + .EXAMPLE DNSoverHTTPS -Disable @@ -13707,6 +13821,9 @@ function WindowsSandbox .LINK https://docs.microsoft.com/en-us/windows-server/networking/dns/doh-client-support + .LINK + https://www.comss.ru/page.php?id=7315 + .NOTES Machine-wide #> @@ -13740,6 +13857,14 @@ function DNSoverHTTPS [string] $SecondaryDNS, + # https://www.comss.ru/page.php?id=7315 + [Parameter( + Mandatory = $true, + ParameterSetName = "ComssOneDNS" + )] + [switch] + $ComssOneDNS, + [Parameter( Mandatory = $true, ParameterSetName = "Disable" @@ -13748,6 +13873,11 @@ function DNSoverHTTPS $Disable ) + if ((Get-CimInstance -ClassName CIM_ComputerSystem).PartOfDomain) + { + return + } + # Determining whether Hyper-V is enabled # After enabling Hyper-V feature a virtual switch breing created, so we need to use different method to isolate the proper adapter if (-not (Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent) @@ -13763,54 +13893,80 @@ function DNSoverHTTPS { "Enable" { - if (-not (Get-CimInstance -ClassName CIM_ComputerSystem).PartOfDomain) + if (((Get-WinHomeLocation).GeoId -ne "203") -or ((Get-WinHomeLocation).GeoId -ne "29")) + { + return + } + + # Set a primary and secondary DNS servers + if (-not (Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent) + { + Get-NetAdapter -Physical | Get-NetIPInterface -AddressFamily IPv4 | Set-DnsClientServerAddress -ServerAddresses $PrimaryDNS, $SecondaryDNS + } + else { - # Set a primary and secondary DNS servers - if (-not (Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent) + Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Set-DnsClientServerAddress -ServerAddresses $PrimaryDNS, $SecondaryDNS + } + + foreach ($InterfaceGuid in $InterfaceGuids) + { + if (-not (Test-Path -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$PrimaryDNS")) { - Get-NetAdapter -Physical | Get-NetIPInterface -AddressFamily IPv4 | Set-DnsClientServerAddress -ServerAddresses $PrimaryDNS, $SecondaryDNS + New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$PrimaryDNS" -Force } - else + if (-not (Test-Path -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$SecondaryDNS")) { - Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Set-DnsClientServerAddress -ServerAddresses $PrimaryDNS, $SecondaryDNS + New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$SecondaryDNS" -Force } + # Encrypted preffered, unencrypted allowed + New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$PrimaryDNS" -Name DohFlags -PropertyType QWord -Value 5 -Force + New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$SecondaryDNS" -Name DohFlags -PropertyType QWord -Value 5 -Force + } + } + "ComssOneDNS" + { + if (-not (((Get-WinHomeLocation).GeoId -eq "203") -or ((Get-WinHomeLocation).GeoId -eq "29"))) + { + return + } - foreach ($InterfaceGuid in $InterfaceGuids) + # Set a primary and secondary DNS servers + if (-not (Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent) + { + Get-NetAdapter -Physical | Get-NetIPInterface -AddressFamily IPv4 | Set-DnsClientServerAddress -ServerAddresses 92.223.65.71 + } + else + { + Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Set-DnsClientServerAddress -ServerAddresses 92.223.65.71 + } + + foreach ($InterfaceGuid in $InterfaceGuids) + { + if (-not (Test-Path -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\92.223.65.71")) { - if (-not (Test-Path -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$PrimaryDNS")) - { - New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$PrimaryDNS" -Force - } - if (-not (Test-Path -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$SecondaryDNS")) - { - New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$SecondaryDNS" -Force - } - # Encrypted preffered, unencrypted allowed - New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$PrimaryDNS" -Name DohFlags -PropertyType QWord -Value 5 -Force - New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$SecondaryDNS" -Name DohFlags -PropertyType QWord -Value 5 -Force + New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\92.223.65.71" -Force } + New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\92.223.65.71" -Name DohFlags -PropertyType QWord -Value 2 -Force + New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\92.223.65.71" -Name DohTemplate -PropertyType String -Value https://dns.comss.one/dns-query -Force } } "Disable" { - if (-not (Get-CimInstance -ClassName CIM_ComputerSystem).PartOfDomain) + # Determining whether Hyper-V is enabled + if (-not (Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent) { - # Determining whether Hyper-V is enabled - if (-not (Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent) - { - # Configure DNS servers automatically - Get-NetAdapter -Physical | Get-NetIPInterface -AddressFamily IPv4 | Set-DnsClientServerAddress -ResetServerAddresses - } - else - { - # Configure DNS servers automatically - Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Set-DnsClientServerAddress -ResetServerAddresses - } + # Configure DNS servers automatically + Get-NetAdapter -Physical | Get-NetIPInterface -AddressFamily IPv4 | Set-DnsClientServerAddress -ResetServerAddresses + } + else + { + # Configure DNS servers automatically + Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Set-DnsClientServerAddress -ResetServerAddresses + } - foreach ($InterfaceGuid in $InterfaceGuids) - { - Remove-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh" -Recurse -Force -ErrorAction Ignore - } + foreach ($InterfaceGuid in $InterfaceGuids) + { + Remove-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh" -Recurse -Force -ErrorAction Ignore } } } diff --git a/src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1 b/src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1 index 93115ff7..146b4436 100644 --- a/src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1 +++ b/src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1 @@ -398,6 +398,14 @@ TaskbarSearch -Hide # Показать поле поиска на панели задач (значение по умолчанию) # TaskbarSearch -SearchBox +# Hide Copilot button on the taskbar +# Скрыть кнопку Copilot с панели задач +CopilotButton -Hide + +# Show Copilot button on the taskbar (default value) +# Отобразить кнопку Copilot на панели задач (значение по умолчанию) +# CopilotButton -Show + # Hide the Task view button from the taskbar # Скрыть кнопку "Представление задач" с панели задач TaskViewButton -Hide @@ -422,6 +430,18 @@ SecondsInSystemClock -Show # Скрыть секунды на часах на панели задач (значение по умолчанию) # SecondsInSystemClock -Hide +# Combine taskbar buttons and always hide labels (default value) +# Объединить кнопки панели задач и всегда скрывать метки (значение по умолчанию) +TaskbarCombine -Always + +# Combine taskbar buttons and hide labels when taskbar is full +# Объединить кнопки панели задач и скрывать метки при переполнении панели задач +# TaskbarCombine -Full + +# Combine taskbar buttons and never hide labels +# Объединить кнопки панели задач и никогда не скрывать метки +# TaskbarCombine -Never + # Unpin the "Microsoft Edge", "Microsoft Store" shortcuts from the taskbar # Открепить ярлыки "Microsoft Edge", "Microsoft Store" от панели задач UnpinTaskbarShortcuts -Shortcuts Edge, Store