Jump to content
EduGeek EdSec 2026 is Go! 27th Oct in Derby! Join us for a day of EdTech security focused talks, networking, and an evening social ×

script to log dns cos some are wrong


Recommended Posts

Posted

dont even know if this will work in the login script yet, rights etc, trying to get it working on my pc. Maybe I overloaded too may braincells on the script I wrote this morning but I'm having trouble understanding why this is doing what its doing

 

@echo off
for /f "tokens=5 delims= " %%a in ('netsh interface ip show dns ^| find "DNS"') do set DNSs=%%a && echo hello > \\server\share$\checkdns\%DNSs%-%computername%.txt

 

output is a file name 192.168.1.11 which contains "hello -ANDY5.txt"

 

output ought to be a file named 192.168.1.11-andy5.txt which contains "hello"

 

 

 

oh i had a thought & found the answer....got rid of the set section and gone with "do echo hello > \\backup\logs$\checkdns\%%a-%computername%.txt"

and now it works for me. I still don't get why it didnt work before...anyone know?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...