Powershell script to ping a list of servers or IP Addresses

Powershell script to ping a list of servers or IP Addresses

Below script can be used as a Powershell script to ping a list of servers or IP Addresses


$ServerName = Get-Content "C:\Users\vb\Desktop\computerslist.txt"

foreach ($Server in $ServerName) { if (test-Connection -ComputerName $Server -Count 2 -Quiet ) { "$Server is Pinging " } else {"$Server not pinging" } }

For Example the Computerslist Text file can have one entry on each line like below having either PC name or IP Addresses

pc1.domain.com
pc2.domain.com
10.100.128.10

Results will be like below for above text file.

pc1.domain.com is Pinging
pc2.domain.com is Pinging
10.100.128.10 is Pinging

Vamshi B

Recent Posts

How to install Firefox browser using Powershell

How to install of FireFox browser using PowerShell Sometimes you would like to install Firefox…

2 years ago

How to install chrome with Powershell?

Quick way to install chrome on windows with Powershell? Launch the Powershell and run below…

2 years ago

How to Fix PowerShell Script Not Digitally Signed Error?

How to Fix PowerShell Script Not Digitally Signed Error? When a script with a .ps1…

2 years ago

Powershell Cheat Sheet for beginners

Powershell Cheat Sheet for beginners PowerShell has become something of an ace in the hole…

2 years ago

Can you use Linux commands in Powershell?

Today we discuss one of a few questions a lot of sysadmins and IT Admins…

2 years ago

Backing Up an SQL Database with PowerShell

Backing Up an SQL Database with PowerShell Before making any changes in the production environment,…

2 years ago

This website uses cookies.