Tuesday
Jan292008
I heart dnscmd
Tuesday, January 29, 2008 at 11:42AM "Hey Laura, I've got this list of 500 A records in our internal DNS that need to be deleted. I know it's a pain, but can you take care of it?"
C:\LauraTools>for /f %h in (a.txt) do dnscmd <DNS Server Name> /RecordDelete <DNS Zone Name> %h A
"Uh, sure boss, what do you need me to do with the other 8 hours and 59 minutes that I'm here today?"
(As an aside, it is the simple genius of the "for-do" loop that leaves me under-motivated to adopt Powershell, as I'm hard-pressed to believe that there's a more elegant way out there to perform the above task.)
in
tech
tech
Reader Comments (2)
$server = 'DNS Server Name'
$zone = 'DNS Zone Name'
get-content a.txt | foreach {dnscmd $server /RecordDelete "$zone $_ A"}
# With use of aliases
gc a.txt |% {dnscmd $server /RecordDelete "$zone $_ A"}
Greetings /\/\o\/\/
C:\NickTools>for /f %h in (a.txt) do dnscmd <DNS Server Name> /RecordDelete <DNS Zone Name> %h A
"Uh, sure boss, what do you need me to do with the other hour that I'm here today?"
<surfs the Net>