Questions tagged [measure-object]
8 questions
4
votes
4 answers
How to prevent PowerShell's Measure-Object cmdlet from truncating your data?
I am tryng to compare the following data to obtain the largest number:
$UserDeets
name lastLogon
---- ---------
Frank Ti 132273694413991065
Frank Ti 132279742884182029
Frank Ti 132282196073500496
Frank Ti…

FrankU32
- 311
- 1
- 3
- 18
2
votes
1 answer
How to exclude a property from 'Measure-Object' in PowerShell?
Function returns the employee name and 3 dates, one for each last site visit. I need to show the name along with whichever date is the most recent of the 3.
$results = get-SiteVisits -Properties Name,Site1,Site2,Site3
$results | ForEach-Object {$_…

Billy Nunya
- 23
- 2
2
votes
2 answers
How do I return only the integer from Measure-Object in PowerShell?
I would like to run a piece of code that counts how many characters are in a text file and save it as another text file but I need the output to only be a number.
This is the code I run in PowerShell:
Get-Content [File location] | Measure-Object…
user11880817
2
votes
3 answers
Alternatives to (Measure-Object -sum).Sum
I'm stuck in the following situation:
I have to get information out of a CSV file. I imported the CSV using Import-Csv.
My raw data looks like this:
45227;01.10.2018 03:24:00;Xxxx Xxxx Xxxxx x XX xxxxxxxxxxxxxx Xxxxx xxx…

JaneDoe
- 23
- 5
1
vote
1 answer
How to only get one column output for Measure-Object Powershell
I'm trying to get the line count of a csv file. I ran this code to get it:
$csvPath = "some.csv"
$lineCount = "linecount.csv"
Import-Csv $csvPath | Select-Object -Skip 1 | Measure-Object | Export-CSV $lineCount -NoTypeInformation
This is the output…

noobCoder
- 89
- 7
1
vote
1 answer
Powershell: How can I avoid counting enters (blanked line) of output from a command?
This is my code to count lines, I only have 69 lines which has a value on each line:
Get-AppPackage | Select-Object -Property name, publisherid | Measure-Object -Property name -line
Output:
Lines Words Characters Property
----- ----- ----------…

BEHXAD
- 43
- 1
- 6
1
vote
2 answers
Powershell - Import-CSV Group-Object SUM a number from grouped objects and then combine all grouped objects to single rows
I have a question similar to this one but with a twist:
Powershell Group Object in CSV and exporting it
My file has 42 existing headers. The delimiter is a standard comma, and there are no quotation marks in this file.…

shadow2020
- 1,315
- 1
- 8
- 30
0
votes
1 answer
How to have Measure-Object count number of lines correctly for files not having CRLF at the last line?
In my understanding, (Get-Content $file | Measure-Object).count should return the total number of lines in the file. It does for some files, but for some generated files the result it gives is less than the correct number by 1. I examines them and…

Ooker
- 1,969
- 4
- 28
- 58