Home » PowerShell » PowerShell Script to check Ping on List of computers

PowerShell Script to check Ping on List of computers


###########################################################################
#
# NAME: Ping List of Computers
#
# AUTHOR: J.Malek (www.malekjakir.com) Email: malek dot one zero four zero at gmail dot com
#
# COMMENT: This script can be used to ping a list of computers.
#
############################################################

$names = Get-Content "C:\Computers.txt"
foreach ($name in $names) {
if ( Test-Connection -ComputerName $name -Count 1 -ErrorAction SilentlyContinue ) {
Write-Host "$name is up" -ForegroundColor Magenta
}
else {
Write-Host "$name is down" -ForegroundColor Red
}
}

Advertisements

9 Comments

  1. Joel says:

    Script worked Perfectly, Thanks a million.

  2. viopsadmin says:

    You would not believe how long it too me to find this. A million sites with flashy stuff that was NOT what I needed. This was exatly what I have been looking for.

    Also, to compose just a list of systems that were down, I made a copy of this that replaces the first write-host statement with Out-null.

    Many thanks! My brain does not like powershell yet, but getting there.

  3. Daniel says:

    Does anyone know what I’d need to add to get it to pause with the results on screen waiting for a command such as “Press any key” before closing?

  4. Ric says:

    Great Job… Thanks man! I owe you a life supply of coffee with all the time this script will save me.

  5. sri says:

    super and simple one – Thank you 🙂

  6. szumigalski says:

    VMware Certified Advanced Professional 6 (Desktop and Mobility Deployment) – The industry-recognized VCAP6-DTM Deploy certification validates that you know how to deploy and optimize VMware Horizon 6 (with View) environments. It demonstrates that you have the understanding and abilities required to leverage best practices to provide a scalable and reliable Business Mobility platform for your organization. Some of the topics include: Configuring and managing Horizon View components, configuring cloud pod archituecture, configuring Group Policy settings related to Horizon View, Configuring and optimizing desktop images for Horizon View & Mirage, Configuring and managing App Volumes AppStacks, Configuring desktop pools, Configuring and deploying ThinApp packaged applications, Configuring VMWare Identity Manager, etc.Szumigalski.com was designed by Sebastian to propagate his interest for PowerShell & VMWare. Sebastian is an IT professional working in Singapore for over fifteen years who’s continually looking for new solutions to improve his technical competencies & know-how. Ever since, Sebastian has became a member of PowerShell User Group & VMWare VMug group, and has been engaged in most of the functions held in Singapore. This website will show you the way Sebastian manage to automate some of his everyday undertakings by using PowerShell. You can find study courses meant for the VCAP6-DTM test, which are personally written by Sebastian. Sebastian is licensed with VCAP6-DTM, and is efficient with virtualization & server maintenance from four years experience in automation. The need for VMWare knowledgable admins and technicians are ever-increasing with the current economic tech industry. Get acquainted with more details on PowerShell & VMWare with Szumigalski.com!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: