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.



gif

143 views0 comments

Recent Posts

See All

How to encrypt and decrypt files in Python When you need to encrypt text, it is important to understand the different options you have. There are different ways to encrypt text, like using a password,

### 👽⚠️ 𝗧𝗵𝗶𝘀 𝘀𝗰𝗿𝗶𝗽𝘁 𝗶𝘀 𝗷𝘂𝘀𝘁 𝘁𝗵𝗲 𝘁𝗼𝗼𝗹 𝗳𝗼𝗿 𝗲𝗱𝘂𝗰𝗮𝘁𝗶𝗼𝗻𝗮𝗹 𝗮𝗻𝗱 𝘁𝗲𝘀𝘁𝗶𝗻𝗴 𝗽𝘂𝗿𝗽𝗼𝘀𝗲𝘀 ⚠️👽 ### Descriptions: This is script for spamming the message from Wh

XML (Extensible Markup Language) is a markup language similar to HTML, but without predefined tags to use. Instead, you define your own tags designed specifically for your needs. This is a powerful wa