Contact Info

Crumbtrail » Administration » Powershell » Powershell 1.0 » Group-Object

Group-Object - Powershell 1.0 CmdLet

ActiveXperts Network Monitor ships with integrated Powershell scripts to monitor complex network. The scripts run out of the box
Download the ActiveXperts Network Monitor FREE version now »


Group the objects that contain the same value for a common property

Group-Object [[-property] Object[]] [-caseSensitive]
		  [-noElement] [-culture string]
            [-inputObject psobject] [CommonParameters]

-property Object[]
       The property or list of properties upon which to group.
       Group upper and lower case values separately.
       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.

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

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