Solved

need to get this powershell to count true school project

Posted on 2016-10-27
3
52 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
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

Backup Solution for AWS

Read about how CloudBerry Backup fully integrates your backups with Amazon S3 and Amazon Glacier to provide military-grade encryption and dramatically cut storage costs on any platform.

Question has a verified solution.

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

The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
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…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

749 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