This code uses an object in the Windows file system to open the file, then read each line at a time until the end of the file.
In case you misplaced the Iplist.ini file, the result will be displayed:
After reading the IP addresses of the incoming files, we now proceed to Ping them with Windows Scripting.
The Ping process is more complicated than reading a text file, because you need to use Windows Management Instrumentation scripting (WMI). You enter the following code:
After running the above script, a pop-up window will appear indicating whether the result of that IP is Ping or not.
In this code, we only ping Ping to a single IP address, and what you need to do is embed the Ping command after each IP address is read from the text file, so you will Ping the entire address list.
Finally, when you have a script to check the IP address and a pop-up window will pop up if you encounter any errors. But if you have to run these scripts on a daily basis, it will not be interesting for most users. Instead, set up so that problems are automatically sent to the email.
To do this you need to know how to send emai via script. On the Internet there are many ways to do it, the most common is using the CDO method.
The above script allows you to send any text in the body of an email to any address using the Gmail service. You can modify the parameters to use for other SMTP mail servers.
Now proceed to put the above code together. As a result, the script will read the IP address, Ping to each address and then send a message string in the body section to the email:
It is easier to automate your work in IT if you take advantage of the power of Windows Scripting. Any time these scripts will automatically check for you, especially if the system has a multitude of devices.