Created
March 22, 2022 11:37
-
-
Save gioxx/c1d0a234983e863344147d1886ec0e10 to your computer and use it in GitHub Desktop.
Rimuove il suffisso DNS inserito in maniera forzata dai router Telecom Italia sulle schede di rete Windows - https://gioxx.org/tag/powershell/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
Remove homenet.telecomitalia.it from Windows DNS Suffix | |
GSolone 22/3/22 | |
Credits: | |
https://superuser.com/a/1507551 | |
https://docs.microsoft.com/en-us/powershell/module/dnsclient/set-dnsclientglobalsetting?view=windowsserver2022-ps&viewFallbackFrom=win10-ps | |
https://www.mssqltips.com/sqlservertip/5459/how-to-modify-the-global-dns-configuration-on-servers-using-powershell/ | |
https://adamtheautomator.com/powershell-replace/ | |
#> | |
try { | |
$dnsCGSetting = Get-DnsClientGlobalSetting | |
if($dnsCGSetting.SuffixSearchList.Contains('homenet.telecomitalia.it')) { | |
$dnsCGClean = $dnsCGSetting.SuffixSearchList.replace('homenet.telecomitalia.it','') | |
Set-DnsClientGlobalSetting -SuffixSearchList $dnsCGClean | |
Write-Host "Telecom suffix removed." | |
} else { | |
Write-Host "No Telecom suffix found." | |
} | |
} catch { | |
Write-Host "An error occurred:" | |
Write-Host $_.ScriptStackTrace | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Assolutamente corretto, hai ragione, ed è il motivo per il quale questo script viene eseguito sulla macchina più volte al giorno / in base a evento (come lo startup del sistema o la connessione a una rete Internet), vedi https://gioxx.org/2022/03/25/kace-rimuovere-il-suffisso-dns-del-router-tim/