Solved

need to get this powershell to count true school project

Posted on 2016-10-27
3
59 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 500 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 explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
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…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

691 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