top of page

PowerShell ISE | Multiple Ping

The Windows PowerShell Integrated Scripting Environment (ISE) is a graphical user interface and front-end hosting application for Windows PowerShell. The ISE enables developers to run PowerShell commands and create, test and refine PowerShell scripts without the need to operate directly in the traditional PowerShell command-line interface (CLI).


At first glance, PowerShell ISE is a convenient GUI for the PowerShell console. The ISE provides a variety of editing controls, user help and other ease-of-use features that aren't readily present in PowerShell. For example, the ISE supports multi-line editing, tab completion, syntax-based coloring, selective execution, context-sensitive help and multi-language support. Menu options and keyboard shortcuts in the ISE mimic many of the common tasks traditionally performed in the PowerShell console.


Advantages of PowerShell ISE:

- Time savings and reduced errors in script creation;

- Improved debugging and testing;

- Greater insight into related scripts, ...


Disadvantages of PowerShell ISE:

- Unnecessary complexity for certain tasks;

- Limited paging;

- Lack of support for certain legacy commands, ...


This is a small utility that allows you to easily ping multiple host names and IP addresses, and export the result in one file.

First of all, you need to create hosts.txt and enter all the IP addresses you need to respond to and run the script below.


Code:

$name=Get-content "C:\tmp\hosts.txt"
foreach($name in $name)
{
if(Test-Connection -ComputerName $name -Count 1 -ErrorAction SilentlyContinue){
Write-Host "$name is up" -ForegroundColor Green
$output+="$name is up!"+"`n"
}
else{
Write-Host "$name is down" -ForegroundColor Red
$output+="$name is down!"+"`n" }
}
$output | Out-File "C:\tmp\result-hosts.txt"
Start-Sleep -s 15

The result:

192.168.0.1 is up!
192.168.0.2 is up!
192.168.0.3 is down!
192.168.0.4 is up!
192.168.0.5 is down!

In the Windows folder (C:\tmp) you will have a new file with the output result of the script.




353 views0 comments

Recent Posts

See All

Mobile | Secret Phone Codes

Our smartphones have become extensions of ourselves, facilitating much of our communication and storing troves of private data. If someone wants to monitor your activity, tapping your phone is a viabl

Mouse & Keyboard Bot

This article illustrates how to automate mouse and keyboard movements using pyautogui module in python. This module is not preloaded with python. So to install it run the following command: The code s

Edit a Website with a Java console

Edit a website – even if it’s not yours! This is how you can edit any website directly from your browser: #1) Open a Webpage; #2) Right-click on any spot in the website, select “Inspect Element”; #3)

bottom of page