troubleshooting Question

Powershell get computers list and ping

Avatar of Tommy_Cooper
Tommy_CooperFlag for Antarctica asked on
7 Comments1 Solution2681 ViewsLast Modified:
Morning everyone,

Please can someone give a bit of instruction....

I want to get a list of servers from Active Directory (using Quest addins) and then for each server returned I want to ping it

So I have this:
$ProdServer=Get-QADComputer -Searchroot '' |Select-Object name

forEach ($Server in $ProdServer)

$Alive=Get-WMIObject win32_pingstatus -Filter "Address-'$Server'" |Select-Object statuscode if ($Alive.statuscode -eq 0)

Write-Host $Server is Reachable
Write-Host $Server is NOT reachable

The problem is that the result I get is this:
@{Name=servername} is NOT reachable

How do I change what I'm inputting to the ping piece so that it doesn't contain the column heading (property name) of 'Name'?

Many thanks :)
Meir Rivkin
Full stack Software Engineer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros