echo hostnames

alisafia
alisafia used Ask the Experts™
on
@echo on
FOR /F %%w IN (C:\temp2\machines.txt) DO psexec \\%%w "netstat.exe" -na | find "1433" >> echo hostname %%w c:\temp2\sqlps.txt
)

I need port and hostnames into a single file.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Sr Manager Software Development
Commented:
@echo on
FOR /F %%w IN (C:\temp2\machines.txt) DO (
      set/p=Hostname %%w <nul >> c:\temp2\sqlps.txt
      psexec \\%%w "netstat.exe" -na | find "1433" >> c:\temp2\sqlps.txt
)

hope this is what you wanted

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