How To Ping List Of Computers/Serves From a Text file and Output to Store Results in a Txt File: One of my reader ask he need a script or PowerShell command that pings list of computers and reports back the IP Adress, so that he can verify if the current IP’s are right place or not
I have used below oneline command with the basic excel work to automate the work, this will be used to get the IP address for list of servers and this will confirms the current server IP address and check the connectivity by doing ping, output result will be in report format and can be used for inventory also
Also Read: Command to Create/Delete bulk DNS Record
Command to get the IP’s for the list for Host/Server names
For /f "tokens=1-3 delims=;" %a in (list.txt) do ping %a | find /n "%a" >>c:\temp\result.txt
Run from location of list.txt file and list.txt file contain the list of host names, for command will read lines from list.txt file and run the ping command for each line, Out put will be stored in result.txt
Result.txt Output file looks like below
[2]Pinging Computer1 [192.168.100.1] with 32 bytes of data:
[2]Pinging Computer2 [192.168.100.2] with 32 bytes of data:
[2]Pinging Computer3 [192.168.100.3] with 32 bytes of data:
[2]Pinging Computer4 [192.168.100.4] with 32 bytes of data:
Also Read: Check the server IP address from multiple servers
How to use Excel to alignment result to required format
- Now Open a excel
- Go to Data – From Text
- Browse and Select Result.txt file
- Select Delimited
- Select others and put [
- Click Next
- Click Finish and OK
- And select the any Column to do further alignment
- Select Text to Columns
- Repeat the step 4 to 7 with different Delimited or Fixed With
Also Read: Search for particular text in multiple logs files or all the files in a folder/disk
We can use above method to get the aliened list of Host name and IP adress as per our requirement, and it’s not a fully automated procedure however easy one to complete the task, I have used this in may occasions to complete the work with less amount of time, hope this will help you
Also Read: To check the list of Users Group Membership