Browse Source

Remove DNSoverHTTPS support and fix for Install-HEVC

Eliminated the DNSoverHTTPS function, its tab completion, and all related usage and documentation from the Windows 10 and LTSC 2021 scripts. Also made minor improvements to error handling in cursor installation and standardized Get-Package usage by removing the -ProviderName parameter for Microsoft Edge and OneDrive.
pull/702/head
Dmitry Nefedov 3 months ago
parent
commit
9f2e2b9327
  1. 24
      src/Sophia_Script_for_Windows_10/Import-TabCompletion.ps1
  2. 359
      src/Sophia_Script_for_Windows_10/Module/Sophia.psm1
  3. 17
      src/Sophia_Script_for_Windows_10/Sophia.ps1
  4. 14
      src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1
  5. 241
      src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1
  6. 17
      src/Sophia_Script_for_Windows_10_LTSC_2021/Sophia.ps1
  7. 24
      src/Sophia_Script_for_Windows_10_PowerShell_7/Import-TabCompletion.ps1
  8. 359
      src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1
  9. 17
      src/Sophia_Script_for_Windows_10_PowerShell_7/Sophia.ps1
  10. 18
      src/Sophia_Script_for_Windows_11/Module/Sophia.psm1
  11. 2
      src/Sophia_Script_for_Windows_11/Sophia.ps1
  12. 18
      src/Sophia_Script_for_Windows_11_ARM/Module/Sophia.psm1
  13. 18
      src/Sophia_Script_for_Windows_11_ARM_PowerShell_7/Module/Sophia.psm1
  14. 14
      src/Sophia_Script_for_Windows_11_LTSC_2024/Module/Sophia.psm1
  15. 18
      src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1

24
src/Sophia_Script_for_Windows_10/Import-TabCompletion.ps1

@ -237,30 +237,6 @@ $Parameters = @{
}
}
# If a module command is DNSoverHTTPS
if ($Command -eq "DNSoverHTTPS")
{
(Get-Command -Name $Command).Name | Where-Object -FilterScript {$_ -like "*$wordToComplete*"}
# Get the valid IPv4 addresses array
# ((Get-Command -Name DNSoverHTTPS).Parametersets.Parameters | Where-Object -FilterScript {$null -eq $_.Attributes.AliasNames}).Attributes.ValidValues | Select-Object -Unique
$ValidValues = @((Get-ChildItem -Path HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters\DohWellKnownServers).PSChildName) | Where-Object {$_ -notmatch ":"}
foreach ($ValidValue in $ValidValues)
{
$ValidValuesDescending = @((Get-ChildItem -Path HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters\DohWellKnownServers).PSChildName) | Where-Object {$_ -notmatch ":"}
foreach ($ValidValueDescending in $ValidValuesDescending)
{
# The "DNSoverHTTPS -Enable -PrimaryDNS x.x.x.x -SecondaryDNS x.x.x.x" construction
"DNSoverHTTPS -Enable -PrimaryDNS $ValidValue -SecondaryDNS $ValidValueDescending" | Where-Object -FilterScript {$_ -like "*$wordToComplete*"} | ForEach-Object -Process {"`"$_`""}
}
}
"DNSoverHTTPS -Disable" | Where-Object -FilterScript {$_ -like "*$wordToComplete*"} | ForEach-Object -Process {"`"$_`""}
"DNSoverHTTPS -ComssOneDNS" | Where-Object -FilterScript {$_ -like "*$wordToComplete*"} | ForEach-Object -Process {"`"$_`""}
continue
}
# If a module command is UserFolders
if ($Command -eq "UserFolders")
{

359
src/Sophia_Script_for_Windows_10/Module/Sophia.psm1

@ -2494,7 +2494,7 @@ function NewsInterests
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Feeds" -Name EnableFeeds -Force -ErrorAction Ignore
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\NewsAndInterests\AllowNewsAndInterests" -Name value -Force -ErrorAction Ignore
if (-not (Get-Package -Name "Microsoft Edge" -ProviderName Programs -ErrorAction Ignore))
if (-not (Get-Package -Name "Microsoft Edge" -ErrorAction Ignore))
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.Skipped -f $MyInvocation.Line.Trim()) -Verbose
@ -3659,6 +3659,8 @@ function Install-Cursors
Write-Warning -Message ($Localization.NoResponse -f "https://raw.githubusercontent.com")
Write-Error -Message ($Localization.NoResponse -f "https://raw.githubusercontent.com") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
}
}
@ -3721,7 +3723,7 @@ function Install-Cursors
Start-Sleep -Seconds 1
Remove-Item -Path "$DownloadsFolder\Windows11Cursors.zip", "$env:SystemRoot\Cursors\W11 Cursor Dark Free\Install.inf" -Force
Remove-Item -Path "$DownloadsFolder\Windows11Cursors.zip", "$env:SystemRoot\Cursors\W11 Cursor Dark Free\Install.inf" -Force -ErrorAction Ignore
}
"Light"
{
@ -4000,7 +4002,7 @@ function OneDrive
{
"Uninstall"
{
[string]$UninstallString = Get-Package -Name "Microsoft OneDrive" -ProviderName Programs -ErrorAction Ignore | ForEach-Object -Process {$_.Meta.Attributes["UninstallString"]}
[string]$UninstallString = Get-Package -Name "Microsoft OneDrive" -ErrorAction Ignore | ForEach-Object -Process {$_.Meta.Attributes["UninstallString"]}
if (-not $UninstallString)
{
@ -4095,7 +4097,7 @@ function OneDrive
}
"Install"
{
$OneDrive = Get-Package -Name "Microsoft OneDrive" -ProviderName Programs -Force -ErrorAction Ignore
$OneDrive = Get-Package -Name "Microsoft OneDrive" -Force -ErrorAction Ignore
if ($OneDrive)
{
Write-Information -MessageData "" -InformationAction Continue
@ -9166,7 +9168,7 @@ function PreventEdgeShortcutCreation
$Disable
)
if (-not (Get-Package -Name "Microsoft Edge" -ProviderName Programs -ErrorAction Ignore))
if (-not (Get-Package -Name "Microsoft Edge" -ErrorAction Ignore))
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.Skipped -f $MyInvocation.Line.Trim()) -Verbose
@ -9186,7 +9188,7 @@ function PreventEdgeShortcutCreation
{
Stable
{
if (Get-Package -Name "Microsoft Edge" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template
@ -9198,7 +9200,7 @@ function PreventEdgeShortcutCreation
}
Beta
{
if (Get-Package -Name "Microsoft Edge Beta" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge Beta" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{2CD8A007-E189-409D-A2C8-9AF4EF3C72AA}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template
@ -9210,7 +9212,7 @@ function PreventEdgeShortcutCreation
}
Dev
{
if (Get-Package -Name "Microsoft Edge Dev" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge Dev" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{0D50BFEC-CD6A-4F9A-964C-C7416E3ACB10}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template
@ -9222,7 +9224,7 @@ function PreventEdgeShortcutCreation
}
Canary
{
if (Get-Package -Name "Microsoft Edge Canary" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge Canary" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{65C35B14-6C1D-4122-AC46-7148CC9D6497}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template
@ -10445,16 +10447,6 @@ function Install-HEVC
try
{
# Checking whether https://store.rg-adguard.net is alive
$Parameters = @{
Uri = "https://store.rg-adguard.net/api/GetFiles"
Method = "Head"
DisableKeepAlive = $true
UseBasicParsing = $true
Verbose = $true
}
(Invoke-WebRequest @Parameters).StatusCode
$Body = @{
type = "url"
url = "https://apps.microsoft.com/detail/9N4WGH0Z6VHQ"
@ -10462,7 +10454,7 @@ function Install-HEVC
lang = "en-US"
}
$Parameters = @{
Uri = "https://store.rg-adguard.net/api/GetFiles"
Uri = "https://ru.store.rg-adguard.net/api/GetFiles"
Method = "Post"
ContentType = "application/x-www-form-urlencoded"
Body = $Body
@ -10470,68 +10462,66 @@ function Install-HEVC
Verbose = $true
}
$Raw = Invoke-WebRequest @Parameters
}
catch [System.Net.WebException]
{
Write-Warning -Message ($Localization.NoResponse -f "https://ru.store.rg-adguard.net")
Write-Error -Message ($Localization.NoResponse -f "https://ru.store.rg-adguard.net") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
# Get a temp URL
$TempURL = $Raw.Links.href | Sort-Object -Property Length -Descending | Select-Object -First 1
$HEVCPackageName = ($Raw.Links.outerHTML | Where-Object -FilterScript {$_ -match "appxbundle"}).Split("_") | Select-Object -Index 1
return
}
# Installing "HEVC Video Extensions from Device Manufacturer"
if ([System.Version]$HEVCPackageName -gt [System.Version](Get-AppxPackage -Name Microsoft.HEVCVideoExtension).Version)
{
try
{
# Checking whether https://store.rg-adguard.net is alive
$Parameters = @{
Uri = $TempURL
UseBasicParsing = $true
Verbose = $true
}
(Invoke-WebRequest @Parameters).StatusCode
# Get a temp URL
$TempURL = $Raw.Links.href | Sort-Object -Property Length -Descending | Select-Object -First 1
# Get package build version
$HEVCPackageName = ($Raw.Links.outerHTML | Where-Object -FilterScript {$_ -match "appxbundle"}).Split("_") | Select-Object -Index 1
Write-Information -MessageData "" -InformationAction Continue
# Extract the localized "Please wait..." string from shell32.dll
Write-Verbose -Message ([WinAPI.GetStrings]::GetString(12612)) -Verbose
try
{
$Parameters = @{
Uri = $TempURL
UseBasicParsing = $true
Verbose = $true
}
(Invoke-WebRequest @Parameters).StatusCode
}
catch [System.Net.WebException]
{
Write-Warning -Message ($Localization.NoResponse -f "http://tlu.dl.delivery.mp.microsoft.com/filestreamingservice")
Write-Error -Message ($Localization.NoResponse -f "http://tlu.dl.delivery.mp.microsoft.com/filestreamingservice") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
Write-Verbose -Message ($Localization.UninstallNotification -f "HEVC Video Extensions from Device Manufacturer") -Verbose
return
}
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
$Parameters = @{
Uri = $TempURL
OutFile = "$DownloadsFolder\Microsoft.HEVCVideoExtension_8wekyb3d8bbwe.appx"
UseBasicParsing = $true
Verbose = $true
}
Invoke-WebRequest @Parameters
# Installing "HEVC Video Extensions from Device Manufacturer"
if ([System.Version]$HEVCPackageName -gt [System.Version](Get-AppxPackage -Name Microsoft.HEVCVideoExtension).Version)
{
Write-Information -MessageData "" -InformationAction Continue
# Extract the localized "Please wait..." string from shell32.dll
Write-Verbose -Message ([WinAPI.GetStrings]::GetString(12612)) -Verbose
Write-Verbose -Message ($Localization.InstallNotification -f "HEVC Video Extensions from Device Manufacturer") -Verbose
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
$Parameters = @{
Uri = $TempURL
OutFile = "$DownloadsFolder\Microsoft.HEVCVideoExtension_8wekyb3d8bbwe.appx"
UseBasicParsing = $true
Verbose = $true
}
Invoke-WebRequest @Parameters
Add-AppxPackage -Path "$DownloadsFolder\Microsoft.HEVCVideoExtension_8wekyb3d8bbwe.appx" -Verbose
Write-Verbose -Message ($Localization.InstallNotification -f "HEVC Video Extensions from Device Manufacturer") -Verbose
Remove-Item -Path "$DownloadsFolder\Microsoft.HEVCVideoExtension_8wekyb3d8bbwe.appx" -Force
}
catch [System.Net.WebException]
{
Write-Warning -Message ($Localization.NoResponse -f "http://tlu.dl.delivery.mp.microsoft.com/filestreamingservice")
Write-Error -Message ($Localization.NoResponse -f "http://tlu.dl.delivery.mp.microsoft.com/filestreamingservice") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
Add-AppxPackage -Path "$DownloadsFolder\Microsoft.HEVCVideoExtension_8wekyb3d8bbwe.appx" -Verbose
return
}
}
else
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.Skipped -f $MyInvocation.Line.Trim()) -Verbose
Write-Error -Message ($Localization.Skipped -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
}
Remove-Item -Path "$DownloadsFolder\Microsoft.HEVCVideoExtension_8wekyb3d8bbwe.appx" -Force
}
catch [System.Net.WebException]
else
{
Write-Warning -Message ($Localization.NoResponse -f "https://store.rg-adguard.net/api/GetFiles")
Write-Error -Message ($Localization.NoResponse -f "https://store.rg-adguard.net/api/GetFiles") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.Skipped -f $MyInvocation.Line.Trim()) -Verbose
Write-Error -Message ($Localization.Skipped -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
}
}
@ -12608,233 +12598,6 @@ function WindowsSandbox
}
}
}
<#
.SYNOPSIS
DNS-over-HTTPS for IPv4
.PARAMETER Enable
Enable DNS-over-HTTPS for IPv4
.PARAMETER Disable
Disable DNS-over-HTTPS for IPv4
.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
.NOTES
The valid IPv4 addresses: 1.0.0.1, 1.1.1.1, 149.112.112.112, 8.8.4.4, 8.8.8.8, 9.9.9.9
.LINK
https://learn.microsoft.com/en-us/windows-server/networking/dns/doh-client-support
.LINK
https://www.comss.ru/page.php?id=7315
.NOTES
Machine-wide
#>
function DNSoverHTTPS
{
[CmdletBinding()]
param
(
[Parameter(
Mandatory = $true,
ParameterSetName = "Enable"
)]
[switch]
$Enable,
[Parameter(Mandatory = $false)]
[ValidateScript({
# Isolate IPv4 IP addresses and check whether $PrimaryDNS is not equal to $SecondaryDNS
((@((Get-ChildItem -Path HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters\DohWellKnownServers).PSChildName) | Where-Object -FilterScript {
($_ -as [IPAddress]).AddressFamily -ne "InterNetworkV6"
}) -contains $_) -and ($_ -ne $SecondaryDNS)
})]
[string]
$PrimaryDNS,
[Parameter(Mandatory = $false)]
[ValidateScript({
# Isolate IPv4 IP addresses and check whether $PrimaryDNS is not equal to $SecondaryDNS
((@((Get-ChildItem -Path HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters\DohWellKnownServers).PSChildName) | Where-Object -FilterScript {
($_ -as [IPAddress]).AddressFamily -ne "InterNetworkV6"
}) -contains $_) -and ($_ -ne $PrimaryDNS)
})]
[string]
$SecondaryDNS,
# https://www.comss.ru/page.php?id=7315
[Parameter(
Mandatory = $true,
ParameterSetName = "ComssOneDNS"
)]
[switch]
$ComssOneDNS,
[Parameter(
Mandatory = $true,
ParameterSetName = "Disable"
)]
[switch]
$Disable
)
# Determining whether Hyper-V is enabled
# After enabling Hyper-V feature a virtual switch being created, so we need to use different method to isolate the proper adapter
if ((Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent)
{
$InterfaceGuids = @((Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Where-Object -FilterScript {$_.Status -eq "Up"}).InterfaceGuid)
}
else
{
$InterfaceGuids = @((Get-NetAdapter -Physical | Where-Object -FilterScript {$_.Status -eq "Up"}).InterfaceGuid)
}
switch ($PSCmdlet.ParameterSetName)
{
"Enable"
{
# Set a primary and secondary DNS servers
if ((Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent)
{
Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Where-Object -FilterScript {$_.Status -eq "Up"} | Set-DnsClientServerAddress -ServerAddresses $PrimaryDNS, $SecondaryDNS
}
else
{
Get-NetAdapter -Physical | Where-Object -FilterScript {$_.Status -eq "Up"} | Get-NetIPInterface -AddressFamily IPv4 | Set-DnsClientServerAddress -ServerAddresses $PrimaryDNS, $SecondaryDNS
}
foreach ($InterfaceGuid in $InterfaceGuids)
{
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
}
}
"ComssOneDNS"
{
switch ((Get-WinHomeLocation).GeoId)
{
{($_ -ne 203) -and ($_ -ne 29)}
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.Skipped -f $MyInvocation.Line.Trim()) -Verbose
Write-Error -Message ($Localization.Skipped -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
}
}
# Resolve dns.comss.one to get its IP address to use
try
{
$ResolveComss = Resolve-DnsName -Name dns.comss.one -NoHostsFile -Verbose
}
catch [System.Net.WebException]
{
Write-Warning -Message ($Localization.NoResponse -f "https://dns.comss.one")
Write-Error -Message ($Localization.NoResponse -f "https://dns.comss.one") -ErrorAction SilentlyContinue
return
}
# Some ISPs block IP address resolving, and user get only one IP address
if ($ResolveComss.IPAddress.Count -eq 1)
{
$FirstIPAddress = $ResolveComss.IPAddress | Select-Object -First 1
}
else
{
$FirstIPAddress = $ResolveComss.IPAddress | Select-Object -First 1
$SecondIPAddress = $ResolveComss.IPAddress | Select-Object -Last 1
}
# Set a primary and secondary DNS servers
# https://www.comss.ru/page.php?id=7315
if ((Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent)
{
if ($SecondIPAddress)
{
Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Where-Object -FilterScript {$_.Status -eq "Up"} | Set-DnsClientServerAddress -ServerAddresses $FirstIPAddress, $SecondIPAddress
}
else
{
Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Where-Object -FilterScript {$_.Status -eq "Up"} | Set-DnsClientServerAddress -ServerAddresses $FirstIPAddress
}
}
else
{
if ($SecondIPAddress)
{
Get-NetAdapter -Physical | Where-Object -FilterScript {$_.Status -eq "Up"} | Get-NetIPInterface -AddressFamily IPv4 | Set-DnsClientServerAddress -ServerAddresses $FirstIPAddress, $SecondIPAddress
}
else
{
Get-NetAdapter -Physical | Where-Object -FilterScript {$_.Status -eq "Up"} | Get-NetIPInterface -AddressFamily IPv4 | Set-DnsClientServerAddress -ServerAddresses $FirstIPAddress
}
}
foreach ($InterfaceGuid in $InterfaceGuids)
{
if (-not (Test-Path -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$FirstIPAddress"))
{
New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$FirstIPAddress" -Force
}
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$FirstIPAddress" -Name DohFlags -PropertyType QWord -Value 2 -Force
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$FirstIPAddress" -Name DohTemplate -PropertyType String -Value https://dns.comss.one/dns-query -Force
if ($SecondIPAddress)
{
if (-not (Test-Path -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$SecondIPAddress"))
{
New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$SecondIPAddress" -Force
}
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$SecondIPAddress" -Name DohFlags -PropertyType QWord -Value 2 -Force
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$SecondIPAddress" -Name DohTemplate -PropertyType String -Value https://dns.comss.one/dns-query -Force
}
}
}
"Disable"
{
# Determining whether Hyper-V is enabled
if ((Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent)
{
# Configure DNS servers automatically
Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Where-Object -FilterScript {$_.Status -eq "Up"} | Set-DnsClientServerAddress -ResetServerAddresses
}
else
{
# Configure DNS servers automatically
Get-NetAdapter -Physical | Where-Object -FilterScript {$_.Status -eq "Up"} | Get-NetIPInterface -AddressFamily IPv4 | Set-DnsClientServerAddress -ResetServerAddresses
}
foreach ($InterfaceGuid in $InterfaceGuids)
{
Remove-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh" -Recurse -Force -ErrorAction Ignore
}
}
}
Clear-DnsClientCache
Register-DnsClient
}
#endregion Microsoft Defender & Security
#region Context menu

17
src/Sophia_Script_for_Windows_10/Sophia.ps1

@ -1167,23 +1167,6 @@ SaveZoneInformation -Disable
# Disable Windows Sandbox (default value). Applicable only to Professional, Enterprise and Education editions
# Выключить Windows Sandbox (значение по умолчанию). Применимо только к редакциям Professional, Enterprise и Education
# WindowsSandbox -Disable
<#
Enable DNS-over-HTTPS for IPv4
The valid IPv4 addresses: 1.0.0.1, 1.1.1.1, 149.112.112.112, 8.8.4.4, 8.8.8.8, 9.9.9.9
Включить DNS-over-HTTPS для IPv4
Действительные IPv4-адреса: 1.0.0.1, 1.1.1.1, 149.112.112.112, 8.8.4.4, 8.8.8.8, 9.9.9.9
#>
DNSoverHTTPS -Enable -PrimaryDNS 1.0.0.1 -SecondaryDNS 1.1.1.1
# Disable DNS-over-HTTPS for IPv4 (default value)
# Выключить DNS-over-HTTPS для IPv4 (значение по умолчанию)
# DNSoverHTTPS -Disable
# Enable DNS-over-HTTPS via Comss.one DNS server. Applicable for Russia only
# Включить DNS-over-HTTPS для IPv4 через DNS-сервер Comss.one. Применимо только для России
# DNSoverHTTPS -ComssOneDNS
#endregion Microsoft Defender & Security
#region Context menu

14
src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1

@ -2716,6 +2716,8 @@ function Install-Cursors
Write-Warning -Message ($Localization.NoResponse -f "https://raw.githubusercontent.com")
Write-Error -Message ($Localization.NoResponse -f "https://raw.githubusercontent.com") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
}
}
@ -2778,7 +2780,7 @@ function Install-Cursors
Start-Sleep -Seconds 1
Remove-Item -Path "$DownloadsFolder\Windows11Cursors.zip", "$env:SystemRoot\Cursors\W11 Cursor Dark Free\Install.inf" -Force
Remove-Item -Path "$DownloadsFolder\Windows11Cursors.zip", "$env:SystemRoot\Cursors\W11 Cursor Dark Free\Install.inf" -Force -ErrorAction Ignore
}
"Light"
{
@ -7601,7 +7603,7 @@ function PreventEdgeShortcutCreation
$Disable
)
if (-not (Get-Package -Name "Microsoft Edge" -ProviderName Programs -ErrorAction Ignore))
if (-not (Get-Package -Name "Microsoft Edge" -ErrorAction Ignore))
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.Skipped -f $MyInvocation.Line.Trim()) -Verbose
@ -7621,7 +7623,7 @@ function PreventEdgeShortcutCreation
{
Stable
{
if (Get-Package -Name "Microsoft Edge" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template
@ -7633,7 +7635,7 @@ function PreventEdgeShortcutCreation
}
Beta
{
if (Get-Package -Name "Microsoft Edge Beta" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge Beta" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{2CD8A007-E189-409D-A2C8-9AF4EF3C72AA}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template
@ -7645,7 +7647,7 @@ function PreventEdgeShortcutCreation
}
Dev
{
if (Get-Package -Name "Microsoft Edge Dev" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge Dev" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{0D50BFEC-CD6A-4F9A-964C-C7416E3ACB10}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template
@ -7657,7 +7659,7 @@ function PreventEdgeShortcutCreation
}
Canary
{
if (Get-Package -Name "Microsoft Edge Canary" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge Canary" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{65C35B14-6C1D-4122-AC46-7148CC9D6497}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template

241
src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1

@ -3096,6 +3096,8 @@ function Install-Cursors
Write-Warning -Message ($Localization.NoResponse -f "https://raw.githubusercontent.com")
Write-Error -Message ($Localization.NoResponse -f "https://raw.githubusercontent.com") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
}
}
@ -3158,7 +3160,7 @@ function Install-Cursors
Start-Sleep -Seconds 1
Remove-Item -Path "$DownloadsFolder\Windows11Cursors.zip", "$env:SystemRoot\Cursors\W11 Cursor Dark Free\Install.inf" -Force
Remove-Item -Path "$DownloadsFolder\Windows11Cursors.zip", "$env:SystemRoot\Cursors\W11 Cursor Dark Free\Install.inf" -Force -ErrorAction Ignore
}
"Light"
{
@ -8240,7 +8242,7 @@ function PreventEdgeShortcutCreation
$Disable
)
if (-not (Get-Package -Name "Microsoft Edge" -ProviderName Programs -ErrorAction Ignore))
if (-not (Get-Package -Name "Microsoft Edge" -ErrorAction Ignore))
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.Skipped -f $MyInvocation.Line.Trim()) -Verbose
@ -8260,7 +8262,7 @@ function PreventEdgeShortcutCreation
{
Stable
{
if (Get-Package -Name "Microsoft Edge" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template
@ -8272,7 +8274,7 @@ function PreventEdgeShortcutCreation
}
Beta
{
if (Get-Package -Name "Microsoft Edge Beta" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge Beta" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{2CD8A007-E189-409D-A2C8-9AF4EF3C72AA}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template
@ -8284,7 +8286,7 @@ function PreventEdgeShortcutCreation
}
Dev
{
if (Get-Package -Name "Microsoft Edge Dev" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge Dev" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{0D50BFEC-CD6A-4F9A-964C-C7416E3ACB10}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template
@ -8296,7 +8298,7 @@ function PreventEdgeShortcutCreation
}
Canary
{
if (Get-Package -Name "Microsoft Edge Canary" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge Canary" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{65C35B14-6C1D-4122-AC46-7148CC9D6497}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template
@ -10733,233 +10735,6 @@ function WindowsSandbox
}
}
}
<#
.SYNOPSIS
DNS-over-HTTPS for IPv4
.PARAMETER Enable
Enable DNS-over-HTTPS for IPv4
.PARAMETER Disable
Disable DNS-over-HTTPS for IPv4
.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
.NOTES
The valid IPv4 addresses: 1.0.0.1, 1.1.1.1, 149.112.112.112, 8.8.4.4, 8.8.8.8, 9.9.9.9
.LINK
https://learn.microsoft.com/en-us/windows-server/networking/dns/doh-client-support
.LINK
https://www.comss.ru/page.php?id=7315
.NOTES
Machine-wide
#>
function DNSoverHTTPS
{
[CmdletBinding()]
param
(
[Parameter(
Mandatory = $true,
ParameterSetName = "Enable"
)]
[switch]
$Enable,
[Parameter(Mandatory = $false)]
[ValidateScript({
# Isolate IPv4 IP addresses and check whether $PrimaryDNS is not equal to $SecondaryDNS
((@((Get-ChildItem -Path HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters\DohWellKnownServers).PSChildName) | Where-Object -FilterScript {
($_ -as [IPAddress]).AddressFamily -ne "InterNetworkV6"
}) -contains $_) -and ($_ -ne $SecondaryDNS)
})]
[string]
$PrimaryDNS,
[Parameter(Mandatory = $false)]
[ValidateScript({
# Isolate IPv4 IP addresses and check whether $PrimaryDNS is not equal to $SecondaryDNS
((@((Get-ChildItem -Path HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters\DohWellKnownServers).PSChildName) | Where-Object -FilterScript {
($_ -as [IPAddress]).AddressFamily -ne "InterNetworkV6"
}) -contains $_) -and ($_ -ne $PrimaryDNS)
})]
[string]
$SecondaryDNS,
# https://www.comss.ru/page.php?id=7315
[Parameter(
Mandatory = $true,
ParameterSetName = "ComssOneDNS"
)]
[switch]
$ComssOneDNS,
[Parameter(
Mandatory = $true,
ParameterSetName = "Disable"
)]
[switch]
$Disable
)
# Determining whether Hyper-V is enabled
# After enabling Hyper-V feature a virtual switch being created, so we need to use different method to isolate the proper adapter
if ((Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent)
{
$InterfaceGuids = @((Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Where-Object -FilterScript {$_.Status -eq "Up"}).InterfaceGuid)
}
else
{
$InterfaceGuids = @((Get-NetAdapter -Physical | Where-Object -FilterScript {$_.Status -eq "Up"}).InterfaceGuid)
}
switch ($PSCmdlet.ParameterSetName)
{
"Enable"
{
# Set a primary and secondary DNS servers
if ((Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent)
{
Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Where-Object -FilterScript {$_.Status -eq "Up"} | Set-DnsClientServerAddress -ServerAddresses $PrimaryDNS, $SecondaryDNS
}
else
{
Get-NetAdapter -Physical | Where-Object -FilterScript {$_.Status -eq "Up"} | Get-NetIPInterface -AddressFamily IPv4 | Set-DnsClientServerAddress -ServerAddresses $PrimaryDNS, $SecondaryDNS
}
foreach ($InterfaceGuid in $InterfaceGuids)
{
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
}
}
"ComssOneDNS"
{
switch ((Get-WinHomeLocation).GeoId)
{
{($_ -ne 203) -and ($_ -ne 29)}
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.Skipped -f $MyInvocation.Line.Trim()) -Verbose
Write-Error -Message ($Localization.Skipped -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
}
}
# Resolve dns.comss.one to get its IP address to use
try
{
$ResolveComss = Resolve-DnsName -Name dns.comss.one -NoHostsFile -Verbose
}
catch [System.Net.WebException]
{
Write-Warning -Message ($Localization.NoResponse -f "https://dns.comss.one")
Write-Error -Message ($Localization.NoResponse -f "https://dns.comss.one") -ErrorAction SilentlyContinue
return
}
# Some ISPs block IP address resolving, and user get only one IP address
if ($ResolveComss.IPAddress.Count -eq 1)
{
$FirstIPAddress = $ResolveComss.IPAddress | Select-Object -First 1
}
else
{
$FirstIPAddress = $ResolveComss.IPAddress | Select-Object -First 1
$SecondIPAddress = $ResolveComss.IPAddress | Select-Object -Last 1
}
# Set a primary and secondary DNS servers
# https://www.comss.ru/page.php?id=7315
if ((Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent)
{
if ($SecondIPAddress)
{
Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Where-Object -FilterScript {$_.Status -eq "Up"} | Set-DnsClientServerAddress -ServerAddresses $FirstIPAddress, $SecondIPAddress
}
else
{
Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Where-Object -FilterScript {$_.Status -eq "Up"} | Set-DnsClientServerAddress -ServerAddresses $FirstIPAddress
}
}
else
{
if ($SecondIPAddress)
{
Get-NetAdapter -Physical | Where-Object -FilterScript {$_.Status -eq "Up"} | Get-NetIPInterface -AddressFamily IPv4 | Set-DnsClientServerAddress -ServerAddresses $FirstIPAddress, $SecondIPAddress
}
else
{
Get-NetAdapter -Physical | Where-Object -FilterScript {$_.Status -eq "Up"} | Get-NetIPInterface -AddressFamily IPv4 | Set-DnsClientServerAddress -ServerAddresses $FirstIPAddress
}
}
foreach ($InterfaceGuid in $InterfaceGuids)
{
if (-not (Test-Path -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$FirstIPAddress"))
{
New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$FirstIPAddress" -Force
}
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$FirstIPAddress" -Name DohFlags -PropertyType QWord -Value 2 -Force
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$FirstIPAddress" -Name DohTemplate -PropertyType String -Value https://dns.comss.one/dns-query -Force
if ($SecondIPAddress)
{
if (-not (Test-Path -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$SecondIPAddress"))
{
New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$SecondIPAddress" -Force
}
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$SecondIPAddress" -Name DohFlags -PropertyType QWord -Value 2 -Force
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$SecondIPAddress" -Name DohTemplate -PropertyType String -Value https://dns.comss.one/dns-query -Force
}
}
}
"Disable"
{
# Determining whether Hyper-V is enabled
if ((Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent)
{
# Configure DNS servers automatically
Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Where-Object -FilterScript {$_.Status -eq "Up"} | Set-DnsClientServerAddress -ResetServerAddresses
}
else
{
# Configure DNS servers automatically
Get-NetAdapter -Physical | Where-Object -FilterScript {$_.Status -eq "Up"} | Get-NetIPInterface -AddressFamily IPv4 | Set-DnsClientServerAddress -ResetServerAddresses
}
foreach ($InterfaceGuid in $InterfaceGuids)
{
Remove-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh" -Recurse -Force -ErrorAction Ignore
}
}
}
Clear-DnsClientCache
Register-DnsClient
}
#endregion Microsoft Defender & Security
#region Context menu

17
src/Sophia_Script_for_Windows_10_LTSC_2021/Sophia.ps1

@ -1005,23 +1005,6 @@ SaveZoneInformation -Disable
# Disable Windows Sandbox (default value)
# Выключить Windows Sandbox (значение по умолчанию)
# WindowsSandbox -Disable
<#
Enable DNS-over-HTTPS for IPv4
The valid IPv4 addresses: 1.0.0.1, 1.1.1.1, 149.112.112.112, 8.8.4.4, 8.8.8.8, 9.9.9.9
Включить DNS-over-HTTPS для IPv4
Действительные IPv4-адреса: 1.0.0.1, 1.1.1.1, 149.112.112.112, 8.8.4.4, 8.8.8.8, 9.9.9.9
#>
DNSoverHTTPS -Enable -PrimaryDNS 1.0.0.1 -SecondaryDNS 1.1.1.1
# Disable DNS-over-HTTPS for IPv4 (default value)
# Выключить DNS-over-HTTPS для IPv4 (значение по умолчанию)
# DNSoverHTTPS -Disable
# Enable DNS-over-HTTPS via Comss.one DNS server. Applicable for Russia only
# Включить DNS-over-HTTPS для IPv4 через DNS-сервер Comss.one. Применимо только для России
# DNSoverHTTPS -ComssOneDNS
#endregion Microsoft Defender & Security
#region Context menu

24
src/Sophia_Script_for_Windows_10_PowerShell_7/Import-TabCompletion.ps1

@ -237,30 +237,6 @@ $Parameters = @{
}
}
# If a module command is DNSoverHTTPS
if ($Command -eq "DNSoverHTTPS")
{
(Get-Command -Name $Command).Name | Where-Object -FilterScript {$_ -like "*$wordToComplete*"}
# Get the valid IPv4 addresses array
# ((Get-Command -Name DNSoverHTTPS).Parametersets.Parameters | Where-Object -FilterScript {$null -eq $_.Attributes.AliasNames}).Attributes.ValidValues | Select-Object -Unique
$ValidValues = @((Get-ChildItem -Path HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters\DohWellKnownServers).PSChildName) | Where-Object {$_ -notmatch ":"}
foreach ($ValidValue in $ValidValues)
{
$ValidValuesDescending = @((Get-ChildItem -Path HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters\DohWellKnownServers).PSChildName) | Where-Object {$_ -notmatch ":"}
foreach ($ValidValueDescending in $ValidValuesDescending)
{
# The "DNSoverHTTPS -Enable -PrimaryDNS x.x.x.x -SecondaryDNS x.x.x.x" construction
"DNSoverHTTPS -Enable -PrimaryDNS $ValidValue -SecondaryDNS $ValidValueDescending" | Where-Object -FilterScript {$_ -like "*$wordToComplete*"} | ForEach-Object -Process {"`"$_`""}
}
}
"DNSoverHTTPS -Disable" | Where-Object -FilterScript {$_ -like "*$wordToComplete*"} | ForEach-Object -Process {"`"$_`""}
"DNSoverHTTPS -ComssOneDNS" | Where-Object -FilterScript {$_ -like "*$wordToComplete*"} | ForEach-Object -Process {"`"$_`""}
continue
}
# If a module command is UserFolders
if ($Command -eq "UserFolders")
{

359
src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1

@ -2494,7 +2494,7 @@ function NewsInterests
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Feeds" -Name EnableFeeds -Force -ErrorAction Ignore
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\NewsAndInterests\AllowNewsAndInterests" -Name value -Force -ErrorAction Ignore
if (-not (Get-Package -Name "Microsoft Edge" -ProviderName Programs -ErrorAction Ignore))
if (-not (Get-Package -Name "Microsoft Edge" -ErrorAction Ignore))
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.Skipped -f $MyInvocation.Line.Trim()) -Verbose
@ -3659,6 +3659,8 @@ function Install-Cursors
Write-Warning -Message ($Localization.NoResponse -f "https://raw.githubusercontent.com")
Write-Error -Message ($Localization.NoResponse -f "https://raw.githubusercontent.com") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
}
}
@ -3721,7 +3723,7 @@ function Install-Cursors
Start-Sleep -Seconds 1
Remove-Item -Path "$DownloadsFolder\Windows11Cursors.zip", "$env:SystemRoot\Cursors\W11 Cursor Dark Free\Install.inf" -Force
Remove-Item -Path "$DownloadsFolder\Windows11Cursors.zip", "$env:SystemRoot\Cursors\W11 Cursor Dark Free\Install.inf" -Force -ErrorAction Ignore
}
"Light"
{
@ -4001,7 +4003,7 @@ function OneDrive
"Uninstall"
{
# {$_.Meta.Attributes["UninstallString"]} is broken
[xml]$UninstallString = Get-Package -Name "Microsoft OneDrive" -ProviderName Programs -ErrorAction Ignore | ForEach-Object -Process {$_.SwidTagText}
[xml]$UninstallString = Get-Package -Name "Microsoft OneDrive" -ErrorAction Ignore | ForEach-Object -Process {$_.SwidTagText}
[string]$UninstallString = $UninstallString.SoftwareIdentity.Meta.UninstallString
if (-not $UninstallString)
@ -4097,7 +4099,7 @@ function OneDrive
}
"Install"
{
$OneDrive = Get-Package -Name "Microsoft OneDrive" -ProviderName Programs -Force -ErrorAction Ignore
$OneDrive = Get-Package -Name "Microsoft OneDrive" -Force -ErrorAction Ignore
if ($OneDrive)
{
Write-Information -MessageData "" -InformationAction Continue
@ -9168,7 +9170,7 @@ function PreventEdgeShortcutCreation
$Disable
)
if (-not (Get-Package -Name "Microsoft Edge" -ProviderName Programs -ErrorAction Ignore))
if (-not (Get-Package -Name "Microsoft Edge" -ErrorAction Ignore))
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.Skipped -f $MyInvocation.Line.Trim()) -Verbose
@ -9188,7 +9190,7 @@ function PreventEdgeShortcutCreation
{
Stable
{
if (Get-Package -Name "Microsoft Edge" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template
@ -9200,7 +9202,7 @@ function PreventEdgeShortcutCreation
}
Beta
{
if (Get-Package -Name "Microsoft Edge Beta" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge Beta" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{2CD8A007-E189-409D-A2C8-9AF4EF3C72AA}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template
@ -9212,7 +9214,7 @@ function PreventEdgeShortcutCreation
}
Dev
{
if (Get-Package -Name "Microsoft Edge Dev" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge Dev" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{0D50BFEC-CD6A-4F9A-964C-C7416E3ACB10}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template
@ -9224,7 +9226,7 @@ function PreventEdgeShortcutCreation
}
Canary
{
if (Get-Package -Name "Microsoft Edge Canary" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge Canary" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{65C35B14-6C1D-4122-AC46-7148CC9D6497}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template
@ -10457,16 +10459,6 @@ function Install-HEVC
try
{
# Checking whether https://store.rg-adguard.net is alive
$Parameters = @{
Uri = "https://store.rg-adguard.net/api/GetFiles"
Method = "Head"
DisableKeepAlive = $true
UseBasicParsing = $true
Verbose = $true
}
(Invoke-WebRequest @Parameters).StatusCode
$Body = @{
type = "url"
url = "https://apps.microsoft.com/detail/9N4WGH0Z6VHQ"
@ -10474,7 +10466,7 @@ function Install-HEVC
lang = "en-US"
}
$Parameters = @{
Uri = "https://store.rg-adguard.net/api/GetFiles"
Uri = "https://ru.store.rg-adguard.net/api/GetFiles"
Method = "Post"
ContentType = "application/x-www-form-urlencoded"
Body = $Body
@ -10482,68 +10474,66 @@ function Install-HEVC
Verbose = $true
}
$Raw = Invoke-WebRequest @Parameters
}
catch [System.Net.WebException]
{
Write-Warning -Message ($Localization.NoResponse -f "https://ru.store.rg-adguard.net")
Write-Error -Message ($Localization.NoResponse -f "https://ru.store.rg-adguard.net") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
# Get a temp URL
$TempURL = $Raw.Links.href | Sort-Object -Property Length -Descending | Select-Object -First 1
$HEVCPackageName = ($Raw.Links.outerHTML | Where-Object -FilterScript {$_ -match "appxbundle"}).Split("_") | Select-Object -Index 1
return
}
# Installing "HEVC Video Extensions from Device Manufacturer"
if ([System.Version]$HEVCPackageName -gt [System.Version](Get-AppxPackage -Name Microsoft.HEVCVideoExtension).Version)
{
try
{
# Checking whether https://store.rg-adguard.net is alive
$Parameters = @{
Uri = $TempURL
UseBasicParsing = $true
Verbose = $true
}
(Invoke-WebRequest @Parameters).StatusCode
# Get a temp URL
$TempURL = $Raw.Links.href | Sort-Object -Property Length -Descending | Select-Object -First 1
# Get package build version
$HEVCPackageName = ($Raw.Links.outerHTML | Where-Object -FilterScript {$_ -match "appxbundle"}).Split("_") | Select-Object -Index 1
Write-Information -MessageData "" -InformationAction Continue
# Extract the localized "Please wait..." string from shell32.dll
Write-Verbose -Message ([WinAPI.GetStrings]::GetString(12612)) -Verbose
try
{
$Parameters = @{
Uri = $TempURL
UseBasicParsing = $true
Verbose = $true
}
(Invoke-WebRequest @Parameters).StatusCode
}
catch [System.Net.WebException]
{
Write-Warning -Message ($Localization.NoResponse -f "http://tlu.dl.delivery.mp.microsoft.com/filestreamingservice")
Write-Error -Message ($Localization.NoResponse -f "http://tlu.dl.delivery.mp.microsoft.com/filestreamingservice") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
Write-Verbose -Message ($Localization.UninstallNotification -f "HEVC Video Extensions from Device Manufacturer") -Verbose
return
}
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
$Parameters = @{
Uri = $TempURL
OutFile = "$DownloadsFolder\Microsoft.HEVCVideoExtension_8wekyb3d8bbwe.appx"
UseBasicParsing = $true
Verbose = $true
}
Invoke-WebRequest @Parameters
# Installing "HEVC Video Extensions from Device Manufacturer"
if ([System.Version]$HEVCPackageName -gt [System.Version](Get-AppxPackage -Name Microsoft.HEVCVideoExtension).Version)
{
Write-Information -MessageData "" -InformationAction Continue
# Extract the localized "Please wait..." string from shell32.dll
Write-Verbose -Message ([WinAPI.GetStrings]::GetString(12612)) -Verbose
Write-Verbose -Message ($Localization.InstallNotification -f "HEVC Video Extensions from Device Manufacturer") -Verbose
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
$Parameters = @{
Uri = $TempURL
OutFile = "$DownloadsFolder\Microsoft.HEVCVideoExtension_8wekyb3d8bbwe.appx"
UseBasicParsing = $true
Verbose = $true
}
Invoke-WebRequest @Parameters
Add-AppxPackage -Path "$DownloadsFolder\Microsoft.HEVCVideoExtension_8wekyb3d8bbwe.appx" -Verbose
Write-Verbose -Message ($Localization.InstallNotification -f "HEVC Video Extensions from Device Manufacturer") -Verbose
Remove-Item -Path "$DownloadsFolder\Microsoft.HEVCVideoExtension_8wekyb3d8bbwe.appx" -Force
}
catch [System.Net.WebException]
{
Write-Warning -Message ($Localization.NoResponse -f "http://tlu.dl.delivery.mp.microsoft.com/filestreamingservice")
Write-Error -Message ($Localization.NoResponse -f "http://tlu.dl.delivery.mp.microsoft.com/filestreamingservice") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
Add-AppxPackage -Path "$DownloadsFolder\Microsoft.HEVCVideoExtension_8wekyb3d8bbwe.appx" -Verbose
return
}
}
else
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.Skipped -f $MyInvocation.Line.Trim()) -Verbose
Write-Error -Message ($Localization.Skipped -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
}
Remove-Item -Path "$DownloadsFolder\Microsoft.HEVCVideoExtension_8wekyb3d8bbwe.appx" -Force
}
catch [System.Net.WebException]
else
{
Write-Warning -Message ($Localization.NoResponse -f "https://store.rg-adguard.net/api/GetFiles")
Write-Error -Message ($Localization.NoResponse -f "https://store.rg-adguard.net/api/GetFiles") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.Skipped -f $MyInvocation.Line.Trim()) -Verbose
Write-Error -Message ($Localization.Skipped -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
}
}
@ -12620,233 +12610,6 @@ function WindowsSandbox
}
}
}
<#
.SYNOPSIS
DNS-over-HTTPS for IPv4
.PARAMETER Enable
Enable DNS-over-HTTPS for IPv4
.PARAMETER Disable
Disable DNS-over-HTTPS for IPv4
.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
.NOTES
The valid IPv4 addresses: 1.0.0.1, 1.1.1.1, 149.112.112.112, 8.8.4.4, 8.8.8.8, 9.9.9.9
.LINK
https://learn.microsoft.com/en-us/windows-server/networking/dns/doh-client-support
.LINK
https://www.comss.ru/page.php?id=7315
.NOTES
Machine-wide
#>
function DNSoverHTTPS
{
[CmdletBinding()]
param
(
[Parameter(
Mandatory = $true,
ParameterSetName = "Enable"
)]
[switch]
$Enable,
[Parameter(Mandatory = $false)]
[ValidateScript({
# Isolate IPv4 IP addresses and check whether $PrimaryDNS is not equal to $SecondaryDNS
((@((Get-ChildItem -Path HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters\DohWellKnownServers).PSChildName) | Where-Object -FilterScript {
($_ -as [IPAddress]).AddressFamily -ne "InterNetworkV6"
}) -contains $_) -and ($_ -ne $SecondaryDNS)
})]
[string]
$PrimaryDNS,
[Parameter(Mandatory = $false)]
[ValidateScript({
# Isolate IPv4 IP addresses and check whether $PrimaryDNS is not equal to $SecondaryDNS
((@((Get-ChildItem -Path HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters\DohWellKnownServers).PSChildName) | Where-Object -FilterScript {
($_ -as [IPAddress]).AddressFamily -ne "InterNetworkV6"
}) -contains $_) -and ($_ -ne $PrimaryDNS)
})]
[string]
$SecondaryDNS,
# https://www.comss.ru/page.php?id=7315
[Parameter(
Mandatory = $true,
ParameterSetName = "ComssOneDNS"
)]
[switch]
$ComssOneDNS,
[Parameter(
Mandatory = $true,
ParameterSetName = "Disable"
)]
[switch]
$Disable
)
# Determining whether Hyper-V is enabled
# After enabling Hyper-V feature a virtual switch being created, so we need to use different method to isolate the proper adapter
if ((Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent)
{
$InterfaceGuids = @((Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Where-Object -FilterScript {$_.Status -eq "Up"}).InterfaceGuid)
}
else
{
$InterfaceGuids = @((Get-NetAdapter -Physical | Where-Object -FilterScript {$_.Status -eq "Up"}).InterfaceGuid)
}
switch ($PSCmdlet.ParameterSetName)
{
"Enable"
{
# Set a primary and secondary DNS servers
if ((Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent)
{
Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Where-Object -FilterScript {$_.Status -eq "Up"} | Set-DnsClientServerAddress -ServerAddresses $PrimaryDNS, $SecondaryDNS
}
else
{
Get-NetAdapter -Physical | Where-Object -FilterScript {$_.Status -eq "Up"} | Get-NetIPInterface -AddressFamily IPv4 | Set-DnsClientServerAddress -ServerAddresses $PrimaryDNS, $SecondaryDNS
}
foreach ($InterfaceGuid in $InterfaceGuids)
{
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
}
}
"ComssOneDNS"
{
switch ((Get-WinHomeLocation).GeoId)
{
{($_ -ne 203) -and ($_ -ne 29)}
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.Skipped -f $MyInvocation.Line.Trim()) -Verbose
Write-Error -Message ($Localization.Skipped -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
}
}
# Resolve dns.comss.one to get its IP address to use
try
{
$ResolveComss = Resolve-DnsName -Name dns.comss.one -NoHostsFile -Verbose
}
catch [System.Net.WebException]
{
Write-Warning -Message ($Localization.NoResponse -f "https://dns.comss.one")
Write-Error -Message ($Localization.NoResponse -f "https://dns.comss.one") -ErrorAction SilentlyContinue
return
}
# Some ISPs block IP address resolving, and user get only one IP address
if ($ResolveComss.IPAddress.Count -eq 1)
{
$FirstIPAddress = $ResolveComss.IPAddress | Select-Object -First 1
}
else
{
$FirstIPAddress = $ResolveComss.IPAddress | Select-Object -First 1
$SecondIPAddress = $ResolveComss.IPAddress | Select-Object -Last 1
}
# Set a primary and secondary DNS servers
# https://www.comss.ru/page.php?id=7315
if ((Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent)
{
if ($SecondIPAddress)
{
Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Where-Object -FilterScript {$_.Status -eq "Up"} | Set-DnsClientServerAddress -ServerAddresses $FirstIPAddress, $SecondIPAddress
}
else
{
Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Where-Object -FilterScript {$_.Status -eq "Up"} | Set-DnsClientServerAddress -ServerAddresses $FirstIPAddress
}
}
else
{
if ($SecondIPAddress)
{
Get-NetAdapter -Physical | Where-Object -FilterScript {$_.Status -eq "Up"} | Get-NetIPInterface -AddressFamily IPv4 | Set-DnsClientServerAddress -ServerAddresses $FirstIPAddress, $SecondIPAddress
}
else
{
Get-NetAdapter -Physical | Where-Object -FilterScript {$_.Status -eq "Up"} | Get-NetIPInterface -AddressFamily IPv4 | Set-DnsClientServerAddress -ServerAddresses $FirstIPAddress
}
}
foreach ($InterfaceGuid in $InterfaceGuids)
{
if (-not (Test-Path -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$FirstIPAddress"))
{
New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$FirstIPAddress" -Force
}
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$FirstIPAddress" -Name DohFlags -PropertyType QWord -Value 2 -Force
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$FirstIPAddress" -Name DohTemplate -PropertyType String -Value https://dns.comss.one/dns-query -Force
if ($SecondIPAddress)
{
if (-not (Test-Path -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$SecondIPAddress"))
{
New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$SecondIPAddress" -Force
}
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$SecondIPAddress" -Name DohFlags -PropertyType QWord -Value 2 -Force
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$SecondIPAddress" -Name DohTemplate -PropertyType String -Value https://dns.comss.one/dns-query -Force
}
}
}
"Disable"
{
# Determining whether Hyper-V is enabled
if ((Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent)
{
# Configure DNS servers automatically
Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Where-Object -FilterScript {$_.Status -eq "Up"} | Set-DnsClientServerAddress -ResetServerAddresses
}
else
{
# Configure DNS servers automatically
Get-NetAdapter -Physical | Where-Object -FilterScript {$_.Status -eq "Up"} | Get-NetIPInterface -AddressFamily IPv4 | Set-DnsClientServerAddress -ResetServerAddresses
}
foreach ($InterfaceGuid in $InterfaceGuids)
{
Remove-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh" -Recurse -Force -ErrorAction Ignore
}
}
}
Clear-DnsClientCache
Register-DnsClient
}
#endregion Microsoft Defender & Security
#region Context menu

17
src/Sophia_Script_for_Windows_10_PowerShell_7/Sophia.ps1

@ -1167,23 +1167,6 @@ SaveZoneInformation -Disable
# Disable Windows Sandbox (default value). Applicable only to Professional, Enterprise and Education editions
# Выключить Windows Sandbox (значение по умолчанию). Применимо только к редакциям Professional, Enterprise и Education
# WindowsSandbox -Disable
<#
Enable DNS-over-HTTPS for IPv4
The valid IPv4 addresses: 1.0.0.1, 1.1.1.1, 149.112.112.112, 8.8.4.4, 8.8.8.8, 9.9.9.9
Включить DNS-over-HTTPS для IPv4
Действительные IPv4-адреса: 1.0.0.1, 1.1.1.1, 149.112.112.112, 8.8.4.4, 8.8.8.8, 9.9.9.9
#>
DNSoverHTTPS -Enable -PrimaryDNS 1.0.0.1 -SecondaryDNS 1.1.1.1
# Disable DNS-over-HTTPS for IPv4 (default value)
# Выключить DNS-over-HTTPS для IPv4 (значение по умолчанию)
# DNSoverHTTPS -Disable
# Enable DNS-over-HTTPS via Comss.one DNS server. Applicable for Russia only
# Включить DNS-over-HTTPS для IPv4 через DNS-сервер Comss.one. Применимо только для России
# DNSoverHTTPS -ComssOneDNS
#endregion Microsoft Defender & Security
#region Context menu

18
src/Sophia_Script_for_Windows_11/Module/Sophia.psm1

@ -3151,6 +3151,8 @@ function Install-Cursors
Write-Warning -Message ($Localization.NoResponse -f "https://raw.githubusercontent.com")
Write-Error -Message ($Localization.NoResponse -f "https://raw.githubusercontent.com") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
}
}
@ -3213,7 +3215,7 @@ function Install-Cursors
Start-Sleep -Seconds 1
Remove-Item -Path "$DownloadsFolder\Windows11Cursors.zip", "$env:SystemRoot\Cursors\W11 Cursor Dark Free\Install.inf" -Force
Remove-Item -Path "$DownloadsFolder\Windows11Cursors.zip", "$env:SystemRoot\Cursors\W11 Cursor Dark Free\Install.inf" -Force -ErrorAction Ignore
}
"Light"
{
@ -3928,7 +3930,7 @@ function OneDrive
{
"Uninstall"
{
[string]$UninstallString = Get-Package -Name "Microsoft OneDrive" -ProviderName Programs -ErrorAction Ignore | ForEach-Object -Process {$_.Meta.Attributes["UninstallString"]}
[string]$UninstallString = Get-Package -Name "Microsoft OneDrive" -ErrorAction Ignore | ForEach-Object -Process {$_.Meta.Attributes["UninstallString"]}
if (-not $UninstallString)
{
@ -4023,7 +4025,7 @@ function OneDrive
}
"Install"
{
$OneDrive = Get-Package -Name "Microsoft OneDrive" -ProviderName Programs -Force -ErrorAction Ignore
$OneDrive = Get-Package -Name "Microsoft OneDrive" -Force -ErrorAction Ignore
if ($OneDrive)
{
Write-Information -MessageData "" -InformationAction Continue
@ -9119,7 +9121,7 @@ function PreventEdgeShortcutCreation
$Disable
)
if (-not (Get-Package -Name "Microsoft Edge" -ProviderName Programs -ErrorAction Ignore))
if (-not (Get-Package -Name "Microsoft Edge" -ErrorAction Ignore))
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.Skipped -f $MyInvocation.Line.Trim()) -Verbose
@ -9139,7 +9141,7 @@ function PreventEdgeShortcutCreation
{
Stable
{
if (Get-Package -Name "Microsoft Edge" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template
@ -9151,7 +9153,7 @@ function PreventEdgeShortcutCreation
}
Beta
{
if (Get-Package -Name "Microsoft Edge Beta" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge Beta" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{2CD8A007-E189-409D-A2C8-9AF4EF3C72AA}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template
@ -9163,7 +9165,7 @@ function PreventEdgeShortcutCreation
}
Dev
{
if (Get-Package -Name "Microsoft Edge Dev" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge Dev" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{0D50BFEC-CD6A-4F9A-964C-C7416E3ACB10}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template
@ -9175,7 +9177,7 @@ function PreventEdgeShortcutCreation
}
Canary
{
if (Get-Package -Name "Microsoft Edge Canary" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge Canary" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{65C35B14-6C1D-4122-AC46-7148CC9D6497}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template

2
src/Sophia_Script_for_Windows_11/Sophia.ps1

@ -95,7 +95,7 @@ if ($Global:Failed)
# Create a restore point
# Создать точку восстановления
CreateRestorePoint
# CreateRestorePoint
#endregion Protection
#region Privacy & Telemetry

18
src/Sophia_Script_for_Windows_11_ARM/Module/Sophia.psm1

@ -3082,6 +3082,8 @@ function Install-Cursors
Write-Warning -Message ($Localization.NoResponse -f "https://raw.githubusercontent.com")
Write-Error -Message ($Localization.NoResponse -f "https://raw.githubusercontent.com") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
}
}
@ -3144,7 +3146,7 @@ function Install-Cursors
Start-Sleep -Seconds 1
Remove-Item -Path "$DownloadsFolder\Windows11Cursors.zip", "$env:SystemRoot\Cursors\W11 Cursor Dark Free\Install.inf" -Force
Remove-Item -Path "$DownloadsFolder\Windows11Cursors.zip", "$env:SystemRoot\Cursors\W11 Cursor Dark Free\Install.inf" -Force -ErrorAction Ignore
}
"Light"
{
@ -3859,7 +3861,7 @@ function OneDrive
{
"Uninstall"
{
[string]$UninstallString = Get-Package -Name "Microsoft OneDrive" -ProviderName Programs -ErrorAction Ignore | ForEach-Object -Process {$_.Meta.Attributes["UninstallString"]}
[string]$UninstallString = Get-Package -Name "Microsoft OneDrive" -ErrorAction Ignore | ForEach-Object -Process {$_.Meta.Attributes["UninstallString"]}
if (-not $UninstallString)
{
@ -3954,7 +3956,7 @@ function OneDrive
}
"Install"
{
$OneDrive = Get-Package -Name "Microsoft OneDrive" -ProviderName Programs -Force -ErrorAction Ignore
$OneDrive = Get-Package -Name "Microsoft OneDrive" -Force -ErrorAction Ignore
if ($OneDrive)
{
Write-Information -MessageData "" -InformationAction Continue
@ -8991,7 +8993,7 @@ function PreventEdgeShortcutCreation
$Disable
)
if (-not (Get-Package -Name "Microsoft Edge" -ProviderName Programs -ErrorAction Ignore))
if (-not (Get-Package -Name "Microsoft Edge" -ErrorAction Ignore))
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.Skipped -f $MyInvocation.Line.Trim()) -Verbose
@ -9011,7 +9013,7 @@ function PreventEdgeShortcutCreation
{
Stable
{
if (Get-Package -Name "Microsoft Edge" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template
@ -9023,7 +9025,7 @@ function PreventEdgeShortcutCreation
}
Beta
{
if (Get-Package -Name "Microsoft Edge Beta" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge Beta" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{2CD8A007-E189-409D-A2C8-9AF4EF3C72AA}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template
@ -9035,7 +9037,7 @@ function PreventEdgeShortcutCreation
}
Dev
{
if (Get-Package -Name "Microsoft Edge Dev" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge Dev" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{0D50BFEC-CD6A-4F9A-964C-C7416E3ACB10}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template
@ -9047,7 +9049,7 @@ function PreventEdgeShortcutCreation
}
Canary
{
if (Get-Package -Name "Microsoft Edge Canary" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge Canary" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{65C35B14-6C1D-4122-AC46-7148CC9D6497}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template

18
src/Sophia_Script_for_Windows_11_ARM_PowerShell_7/Module/Sophia.psm1

@ -3082,6 +3082,8 @@ function Install-Cursors
Write-Warning -Message ($Localization.NoResponse -f "https://raw.githubusercontent.com")
Write-Error -Message ($Localization.NoResponse -f "https://raw.githubusercontent.com") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
}
}
@ -3144,7 +3146,7 @@ function Install-Cursors
Start-Sleep -Seconds 1
Remove-Item -Path "$DownloadsFolder\Windows11Cursors.zip", "$env:SystemRoot\Cursors\W11 Cursor Dark Free\Install.inf" -Force
Remove-Item -Path "$DownloadsFolder\Windows11Cursors.zip", "$env:SystemRoot\Cursors\W11 Cursor Dark Free\Install.inf" -Force -ErrorAction Ignore
}
"Light"
{
@ -3860,7 +3862,7 @@ function OneDrive
"Uninstall"
{
# {$_.Meta.Attributes["UninstallString"]} is broken
[xml]$UninstallString = Get-Package -Name "Microsoft OneDrive" -ProviderName Programs -ErrorAction Ignore | ForEach-Object -Process {$_.SwidTagText}
[xml]$UninstallString = Get-Package -Name "Microsoft OneDrive" -ErrorAction Ignore | ForEach-Object -Process {$_.SwidTagText}
[string]$UninstallString = $UninstallString.SoftwareIdentity.Meta.UninstallString
if (-not $UninstallString)
@ -3956,7 +3958,7 @@ function OneDrive
}
"Install"
{
$OneDrive = Get-Package -Name "Microsoft OneDrive" -ProviderName Programs -Force -ErrorAction Ignore
$OneDrive = Get-Package -Name "Microsoft OneDrive" -Force -ErrorAction Ignore
if ($OneDrive)
{
Write-Information -MessageData "" -InformationAction Continue
@ -8993,7 +8995,7 @@ function PreventEdgeShortcutCreation
$Disable
)
if (-not (Get-Package -Name "Microsoft Edge" -ProviderName Programs -ErrorAction Ignore))
if (-not (Get-Package -Name "Microsoft Edge" -ErrorAction Ignore))
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.Skipped -f $MyInvocation.Line.Trim()) -Verbose
@ -9013,7 +9015,7 @@ function PreventEdgeShortcutCreation
{
Stable
{
if (Get-Package -Name "Microsoft Edge" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template
@ -9025,7 +9027,7 @@ function PreventEdgeShortcutCreation
}
Beta
{
if (Get-Package -Name "Microsoft Edge Beta" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge Beta" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{2CD8A007-E189-409D-A2C8-9AF4EF3C72AA}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template
@ -9037,7 +9039,7 @@ function PreventEdgeShortcutCreation
}
Dev
{
if (Get-Package -Name "Microsoft Edge Dev" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge Dev" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{0D50BFEC-CD6A-4F9A-964C-C7416E3ACB10}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template
@ -9049,7 +9051,7 @@ function PreventEdgeShortcutCreation
}
Canary
{
if (Get-Package -Name "Microsoft Edge Canary" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge Canary" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{65C35B14-6C1D-4122-AC46-7148CC9D6497}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template

14
src/Sophia_Script_for_Windows_11_LTSC_2024/Module/Sophia.psm1

@ -2999,6 +2999,8 @@ function Install-Cursors
Write-Warning -Message ($Localization.NoResponse -f "https://raw.githubusercontent.com")
Write-Error -Message ($Localization.NoResponse -f "https://raw.githubusercontent.com") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
}
}
@ -3061,7 +3063,7 @@ function Install-Cursors
Start-Sleep -Seconds 1
Remove-Item -Path "$DownloadsFolder\Windows11Cursors.zip", "$env:SystemRoot\Cursors\W11 Cursor Dark Free\Install.inf" -Force
Remove-Item -Path "$DownloadsFolder\Windows11Cursors.zip", "$env:SystemRoot\Cursors\W11 Cursor Dark Free\Install.inf" -Force -ErrorAction Ignore
}
"Light"
{
@ -8626,7 +8628,7 @@ function PreventEdgeShortcutCreation
$Disable
)
if (-not (Get-Package -Name "Microsoft Edge" -ProviderName Programs -ErrorAction Ignore))
if (-not (Get-Package -Name "Microsoft Edge" -ErrorAction Ignore))
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.Skipped -f $MyInvocation.Line.Trim()) -Verbose
@ -8646,7 +8648,7 @@ function PreventEdgeShortcutCreation
{
Stable
{
if (Get-Package -Name "Microsoft Edge" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template
@ -8658,7 +8660,7 @@ function PreventEdgeShortcutCreation
}
Beta
{
if (Get-Package -Name "Microsoft Edge Beta" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge Beta" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{2CD8A007-E189-409D-A2C8-9AF4EF3C72AA}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template
@ -8670,7 +8672,7 @@ function PreventEdgeShortcutCreation
}
Dev
{
if (Get-Package -Name "Microsoft Edge Dev" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge Dev" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{0D50BFEC-CD6A-4F9A-964C-C7416E3ACB10}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template
@ -8682,7 +8684,7 @@ function PreventEdgeShortcutCreation
}
Canary
{
if (Get-Package -Name "Microsoft Edge Canary" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge Canary" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{65C35B14-6C1D-4122-AC46-7148CC9D6497}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template

18
src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1

@ -3151,6 +3151,8 @@ function Install-Cursors
Write-Warning -Message ($Localization.NoResponse -f "https://raw.githubusercontent.com")
Write-Error -Message ($Localization.NoResponse -f "https://raw.githubusercontent.com") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
return
}
}
@ -3213,7 +3215,7 @@ function Install-Cursors
Start-Sleep -Seconds 1
Remove-Item -Path "$DownloadsFolder\Windows11Cursors.zip", "$env:SystemRoot\Cursors\W11 Cursor Dark Free\Install.inf" -Force
Remove-Item -Path "$DownloadsFolder\Windows11Cursors.zip", "$env:SystemRoot\Cursors\W11 Cursor Dark Free\Install.inf" -Force -ErrorAction Ignore
}
"Light"
{
@ -3929,7 +3931,7 @@ function OneDrive
"Uninstall"
{
# {$_.Meta.Attributes["UninstallString"]} is broken
[xml]$UninstallString = Get-Package -Name "Microsoft OneDrive" -ProviderName Programs -ErrorAction Ignore | ForEach-Object -Process {$_.SwidTagText}
[xml]$UninstallString = Get-Package -Name "Microsoft OneDrive" -ErrorAction Ignore | ForEach-Object -Process {$_.SwidTagText}
[string]$UninstallString = $UninstallString.SoftwareIdentity.Meta.UninstallString
if (-not $UninstallString)
@ -4025,7 +4027,7 @@ function OneDrive
}
"Install"
{
$OneDrive = Get-Package -Name "Microsoft OneDrive" -ProviderName Programs -Force -ErrorAction Ignore
$OneDrive = Get-Package -Name "Microsoft OneDrive" -Force -ErrorAction Ignore
if ($OneDrive)
{
Write-Information -MessageData "" -InformationAction Continue
@ -9121,7 +9123,7 @@ function PreventEdgeShortcutCreation
$Disable
)
if (-not (Get-Package -Name "Microsoft Edge" -ProviderName Programs -ErrorAction Ignore))
if (-not (Get-Package -Name "Microsoft Edge" -ErrorAction Ignore))
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.Skipped -f $MyInvocation.Line.Trim()) -Verbose
@ -9141,7 +9143,7 @@ function PreventEdgeShortcutCreation
{
Stable
{
if (Get-Package -Name "Microsoft Edge" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template
@ -9153,7 +9155,7 @@ function PreventEdgeShortcutCreation
}
Beta
{
if (Get-Package -Name "Microsoft Edge Beta" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge Beta" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{2CD8A007-E189-409D-A2C8-9AF4EF3C72AA}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template
@ -9165,7 +9167,7 @@ function PreventEdgeShortcutCreation
}
Dev
{
if (Get-Package -Name "Microsoft Edge Dev" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge Dev" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{0D50BFEC-CD6A-4F9A-964C-C7416E3ACB10}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template
@ -9177,7 +9179,7 @@ function PreventEdgeShortcutCreation
}
Canary
{
if (Get-Package -Name "Microsoft Edge Canary" -ProviderName Programs -ErrorAction Ignore)
if (Get-Package -Name "Microsoft Edge Canary" -ErrorAction Ignore)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\EdgeUpdate -Name "CreateDesktopShortcut{65C35B14-6C1D-4122-AC46-7148CC9D6497}" -PropertyType DWord -Value 0 -Force
# msedgeupdate.admx is not a default ADMX template

Loading…
Cancel
Save