daily pastebin goal
88%
SHARE
TWEET

Untitled

a guest Jul 31st, 2016 346 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. $log_path = "C:\scripts\logs.txt"
  2. $rollback_path = "C:\scripts\"
  3. $current_rollback_list_name = "current_roll_back.list"
  4. $current_rollback = $rollback_path + $current_rollback_list_name
  5. $rollback_date = get-date -format "M_dd_yyyy"
  6. $rollback_backup_file = $rollback_path + "rollback_" + $rollback_date + ".list"
  7. $tmp_file_holder = "current_list.bk"
  8.  
  9.  
  10. if(test-path $current_rollback) {
  11.     try {
  12.     move-item $current_rollback $rollback_backup_file -force
  13.     } catch {
  14.             echo $_ >> $log_path
  15.     }
  16. }
  17.  
  18. $domain_list = invoke-webrequest http://mirror1.malwaredomains.com/files/domains.txt | select -expandproperty content
  19. $domain_list -replace "`t", ";" -replace ";;" >  $tmp_file_holder
  20. $domain_content = get-content $tmp_file_holder
  21.  
  22. $zone_list = get-dnsserverzone | where {$_.IsDsIntegrated -eq $false} | select -expandproperty Zonename
  23.  
  24. foreach($line in $domain_content){
  25.     if(-not($line | select-string "#")) {
  26.     $line_tmp = $line -split ";"
  27.     $line = $line_tmp[0]
  28.         if($zone_list -notcontains $line) {
  29.             try {
  30.             Add-DnsServerPrimaryZone "$line" -DynamicUpdate "none" -ZoneFile "$line.dns"
  31.             } catch {
  32.             echo $_ >> $log_path
  33.             }
  34.         }
  35.         echo "$line" | Out-File -FilePath $current_rollback -Encoding ascii -append
  36.     }
  37. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top