@ -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