?
Solved

need to get this powershell to count true school project

Posted on 2016-10-27
3
Medium Priority
?
70 Views
Last Modified: 2016-11-10
need to get it to count how many are true after its run
100..120 | % {"192.168.100.$($_): $(Test-Connection -count 1 -comp 192.168.100.$($_) -quiet)"}
pause
$true.count
$true
pause
0
Comment
Question by:bob scott
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 40

Accepted Solution

by:
Subsun earned 2000 total points
ID: 41862056
Save the result to a variable and then count the true values from result..
Try..
$Result = 100..120 | % {"192.168.100.$($_): $(Test-Connection -count 1 -comp 192.168.100.$($_) -quiet)"}

($Result | Select-String "True" | Measure).Count

Open in new window

1
 

Author Closing Comment

by:bob scott
ID: 41882234
Worked great
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will help you understand what HashTables are and how to use them in PowerShell.
A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question