Skip to content

Commit

Permalink
Merge pull request #4 from HotCakeX/v0.0.5-update
Browse files Browse the repository at this point in the history
V0.0.5 Update
  • Loading branch information
HotCakeX authored Feb 12, 2024
2 parents feba38f + 858feeb commit 2a76e4f
Show file tree
Hide file tree
Showing 24 changed files with 1,371 additions and 754 deletions.
119 changes: 0 additions & 119 deletions WinSecureDNSMgr/CommonResources.psm1

This file was deleted.

92 changes: 0 additions & 92 deletions WinSecureDNSMgr/Get-ManualNetworkAdapterWinSecureDNS.psm1

This file was deleted.

59 changes: 59 additions & 0 deletions WinSecureDNSMgr/Module/Main/Reset-DoHSettings.psm1
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
Function Reset-DoHSettings {
[Alias('Reset-DoH')]
[CmdletBinding()]
[OutputType([System.Void])]
param()

# Importing the $PSDefaultParameterValues to the current session, prior to everything else
. "$WinSecureDNSMgrModuleRootPath\MainExt\PSDefaultParameterValues.ps1"

Write-Verbose -Message 'Displaying non-system DoH templates.'
Get-DnsClientDohServerAddress | Where-Object -FilterScript { $_.DohTemplate -notin $BuiltInDoHTemplatesReference.Values.Values.Values } |
ForEach-Object -Process {
Write-Verbose -Message "Non-System DoH template with the Server Address $($_.ServerAddress) and Domain $($_.DohTemplate) detected."
}

Write-Verbose -Message 'Resetting the DNS server IP addresses of all network adapters to the default values'
$(Get-DnsClientServerAddress).InterfaceIndex | Select-Object -Unique | ForEach-Object -Process {
Set-DnsClientServerAddress -ResetServerAddresses -InterfaceIndex $_
}

Write-Verbose -Message 'Removing all DoH templates from the system.'
Get-DnsClientDohServerAddress | ForEach-Object -Process {
Remove-DnsClientDohServerAddress -InputObject $_
}

Write-Verbose -Message 'Restoring the default Windows DoH templates.'
foreach ($DoH in $BuiltInDoHTemplatesReference.GetEnumerator()) {

# Loop over IPv4 details
foreach ($IPv4s in $DoH.Value.GetEnumerator() | Where-Object -FilterScript { $_.name -eq 'IPv4' }) {

# Loop over each IPv4 address and its DoH domain
foreach ($IPv4 in $IPv4s.Value.GetEnumerator()) {
Add-DnsClientDohServerAddress -AllowFallbackToUdp $false -AutoUpgrade $True -ServerAddress $IPv4.Name -DohTemplate $IPv4.Value | Out-Null
}
}

# Loop over IPv6 details
foreach ($IPv6s in $DoH.Value.GetEnumerator() | Where-Object -FilterScript { $_.name -eq 'IPv6' }) {

# Loop over each IPv6 address and its DoH domain
foreach ($IPv6 in $IPv6s.Value.GetEnumerator()) {
Add-DnsClientDohServerAddress -AllowFallbackToUdp $false -AutoUpgrade $True -ServerAddress $IPv6.Name -DohTemplate $IPv6.Value | Out-Null
}
}
}

<#
.SYNOPSIS
Removes all of the saved DoH templates from the system and then restores back the default templates
Resets the DNS server IP addresses of all network adapters to the default values
.INPUTS
None
.OUTPUTS
System.Void
.PARAMETER Verbose
Switch to enable verbose output
#>
}
Loading

0 comments on commit 2a76e4f

Please sign in to comment.