@Echo OFF
SETLocal EnableDelayedExpansion
CLS
DEL DNSCheckReport.CSV
Echo HostName, Found in DNS?, IP Address > DNSCheckReport.CSV
FOR /F “Tokens=1” %%L IN (PCList.TXT) DO (
SET PCName=
SET PCName=%%L
SET FoundInDNS=
SET HostIP=
Echo Checking !PCNAme!…
IF EXIST This.TXT DEL This.TXT
PING !PCName! -n 1 > This.TXT 2>&1
Find /i “Pinging” < This.TXT
IF !ErrorLevel! == 0 (
SET FoundInDNS=Yes
Find /i “[” < This.TXT > ThisR.TXT
FOR /F “Tokens=1-2 delims=[” %%R IN (ThisR.TXT) DO SET HostIP=%%S
) ELSE (
SET FoundInDNS=No
SET HostIP=
)
Echo !PCName!, !FoundInDNS!, !HostIP! >> DNSCheckReport.CSV
)
About Nirmal Sharma
Nirmal is a MCSEx3, MCITP and was awarded Microsoft MVP award in Directory Services and Windows Networking. He is specialized in Directory Services, Failover cluster, Hyper-V, System Center, Windows Azure, and Exchange Servers and has been involved in Microsoft Technologies since 1994. In his spare time, he offers technical help by writing tips and articles on several web sites. Nirmal can be reached at [email protected].