Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $log_path = "C:\scripts\logs.txt"
- $rollback_path = "C:\scripts\"
- $current_rollback_list_name = "current_roll_back.list"
- $current_rollback = $rollback_path + $current_rollback_list_name
- $rollback_date = get-date -format "M_dd_yyyy"
- $rollback_backup_file = $rollback_path + "rollback_" + $rollback_date + ".list"
- $tmp_file_holder = "current_list.bk"
- if(test-path $current_rollback) {
- try {
- move-item $current_rollback $rollback_backup_file -force
- } catch {
- echo $_ >> $log_path
- }
- }
- $domain_list = invoke-webrequest http://mirror1.malwaredomains.com/files/domains.txt | select -expandproperty content
- $domain_list -replace "`t", ";" -replace ";;" > $tmp_file_holder
- $domain_content = get-content $tmp_file_holder
- $zone_list = get-dnsserverzone | where {$_.IsDsIntegrated -eq $false} | select -expandproperty Zonename
- foreach($line in $domain_content){
- if(-not($line | select-string "#")) {
- $line_tmp = $line -split ";"
- $line = $line_tmp[0]
- if($zone_list -notcontains $line) {
- try {
- Add-DnsServerPrimaryZone "$line" -DynamicUpdate "none" -ZoneFile "$line.dns"
- } catch {
- echo $_ >> $log_path
- }
- }
- echo "$line" | Out-File -FilePath $current_rollback -Encoding ascii -append
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement