Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

need to get this powershell to count true school project

Posted on 2016-10-27
3
Medium Priority
?
82 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

Does Powershell have you tied up in knots?

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

My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
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…
Loops Section Overview

610 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