Script to Ping list of Computers to Reports Back with the Current IP’s for Inventory

By | August 5, 2015

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

  1. Now Open a excel
  2. Go to Data – From Text
  3. Browse and Select Result.txt file
  4. Select Delimited
  5. Select others and put [
  6. Click Next
  7. Click Finish and OK
  8. And select the any Column to do further alignment
  9. Select Text to Columns
  10. 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

 

Leave a Reply

Your email address will not be published. Required fields are marked *