I already set all clients with DNS Server on mikrotik but the script failed to resolve.
:local LISTNAME "WindowsUpdatesList"
:local TARGET1 "update.microsoft.com"
:local TARGET2 "download.windowsupdate.com"
:local TARGET3 "download.microsoft.com"
:local TARGET4 "windowsupdate.com"
:local TARGET5 "ntservicepack.microsoft.com"
:local TARGET6 "wustat.windows.com"
:local TARGET7 "stats.microsoft.com"
:local TARGET8 "mp.microsoft.com"
:local TARGET9 "ws.microsoft.com"
:local TARGET10 "sls.update.microsoft.com.akadns.net"
:local TARGET11 "vortex.data.microsoft.com"
:local TARGET12 "vortex-win.data.microsoft.com"
:local TARGET13 "fe2.update.microsoft.com.akadns.net"
:local TARGET14 "statsfe2.update.microsoft.com.akadns.net"
:if ( [/ip firewall address-list find where list=$LISTNAME] = "") do={
:log warning "No Address List For $TARGET1 Found! Creating And Adding Resolved Entry For 1st Time Usage"
:resolve $TARGET1
ip firewall address-list add list=$LISTNAME
} else={
:log warning "Previous List For $LISTNAME Found! Moving Forward And Checking If DNS Entries Can Be Added In It"
}
:foreach i in=[/ip dns cache all find where (name~"$TARGET1" || name~"$TARGET2" || name~"$TARGET3" || name~"$TARGET4" || name~"$TARGET5" || name~"$TARGET6" || name~"$TARGET7" || name~"$TARGET8" || name~"$TARGET9" || name~"$TARGET10" || name~"$TARGET11" || name~"$TARGET12" || name~"$TARGET13" || name~"$TARGET14") && (type="A") ] do={
:local Buffer [/ip dns cache get $i address];
delay delay-time=10ms
:if ( [/ip firewall address-list find where address=$Buffer] = "") do={
:local sitednsname [/ip dns cache get $i name] ;
:log info ("added entry: $sitednsname $Buffer");
/ip firewall address-list add address=$Buffer list=$LISTNAME comment=$sitednsname;
}
}
from resolve i got ip address 0.0.0.0
can someone here help me ? thank you