Aug 26 2021 12:56 AM
Hi,
is it possible to block a list of domain that i have on a txt file on a dns server?
Aug 26 2021 05:26 AM
Aug 26 2021 05:51 AM
Aug 26 2021 06:46 AM
SolutionYou may automate it using PowerShell, you may add the list into a Excel document and save it with CSV format and then use Import-Csv command to import it as a list in the PowerShell, take a look at Import-Csv (Microsoft.PowerShell.Utility) - PowerShell | Microsoft Docs
Then use function like Add-DnsServerPrimaryZone in a loop or and it will read each record and add it to the DNS. Take a look at Add-DnsServerPrimaryZone (DnsServer) | Microsoft Docs
Try to create a script for one record and then if it works as you expected then use the list.
Aug 26 2021 11:47 PM - edited Aug 26 2021 11:48 PM
This is not a bad idea, but instead of make and import csv, is better to read the txt file directly with:
Get-Content .\file.txt | ForEach-Object {
Add-DnsServerPrimaryZone ....
}
Aug 27 2021 07:17 AM