You are here:

WindowsManagement.com > PowerShell > PowerShell 1.0 > Group-Object
ActiveXperts Network Monitor 2015 proactively manages network servers, devices, databases and more.

Group-Object - PowerShell 1.0

Microsoft Windows PowerShell is a command-line shell and scripting tool based on the Microsoft .NET Framework. It is designed for system administrators, engineers and developers to control and automate the administration of Windows and applications.

More than hundred command-line tools (so called "cmdlets") can be used to perform system administration tasks and Windows Management Instrumentation (WMI). These cmdlets are easy to use, with standard naming conventions and common parameters, and standard tools for piping, sorting, filtering, and formatting data and objects.

Group-Object


Description
Back up your Hyper-V VMs Easy & Fast. 100% built for Hyper-V. Free for 2 VMs, forever.

Usage


Options
-property Object[]
       The property or list of properties upon which to group.
        
   -caseSensitive
       Group upper and lower case values separately.
        
   -noElement
       Don't include elements of each group in the output objects.

   -culture string
       The culture to use when performing a string comparison.
        
   -inputObject psobject
       The objects to group. May be pipelined.
       A variable command or expression that gets the objects.

   CommonParameters:
       -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutVariable.

Example(s)
Display a list of files grouped by size:

PS C:\>get-childitem *.doc | group-object -property length

Display a list of files, sorted and then grouped by the file extension:

PS C:\>get-childitem | sort-object -property extension | group-object -property extension

Count the file extensions (in the current directory) without retrieving all the files:

PS C:\>get-childitem | group-object extension -noelement