PowerShell/Scripts/train_dns_cache.ps1

23 lines
599 B
PowerShell
Raw Normal View History

2020-06-11 16:15:23 +02:00
#!/snap/bin/powershell
#
2020-06-18 19:26:49 +02:00
# Syntax: train_dns_cache
2020-06-15 14:55:54 +02:00
# Description: trains the DNS cache with frequently used domain names
# Author: Markus Fleschutz
# Source: github.com/fleschutz/PowerShell
# License: CC0
#
2020-06-18 19:26:49 +02:00
$Table = import-csv domain_table.csv
2020-06-11 16:15:23 +02:00
2020-09-19 08:52:03 +02:00
$StartTime = Get-Date
2020-06-18 19:26:49 +02:00
foreach($Row in $Table) {
$Domain = $Row.Domain
write-progress "Training DNS cache with $Domain ..."
$Ignore = nslookup $Domain
2020-06-11 16:15:23 +02:00
}
2020-06-11 18:20:40 +02:00
2020-06-18 19:26:49 +02:00
$Count = $Table.Length
2020-09-19 08:52:03 +02:00
$StopTime = Get-Date
$TimeInterval = New-Timespan -start $StartTime -end $StopTime
write-host "OK - DNS cache trained with $Count domain names in $TimeInterval sec."
2020-06-11 16:15:23 +02:00
exit 0