Check if DNS suffix is right. I will need to extract the DNS suffix from all the computers in a file.

bsharath
bsharath used Ask the Experts™
on
Hi,

Check if DNS suffix is right. I will need to extract the DNS suffix from all the computers in a file.
There can be more than one so have them in a row with a coma delimiter

Regards
Raja
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Can you explain better ?
Michael EagerConsultant

Commented:
Give an example of what you are trying to do.  
Commented:
Here's a batch file that should do it.

I did not test it but it demonstrats well my idea on how to resolve this issue.

 
@ECHO OFF

REM EXPECTING YOU PUT YOUR COMPUTER LIST SEPARATED BY NEW LINES
REM NOT CSV IN ONE LINE

SET DomainName=mydomainname.local
SET ComputerList=list.txt

FOR /F "usebackq delims=" %%A IN ("%ComputerList%") DO WMIC /node:%%A computersystem GET domain | FINDSTR -i "%DomainName% && (ECHO OK %%A) ELSE (ECHO ER %%A)

PAUSE

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial