Skip to main content

Powershell: Sort-Object

Sort-Object - Sorts objects by property values.

Alias: sort

PS C:\> get-help Sort-Object

NAME
    Sort-Object

SYNOPSIS
    Sorts objects by property values.


SYNTAX
    Sort-Object [[-Property] ] [-CaseSensitive] [-Culture ] [-Descending] [-InputObject
    ] [-Unique] []


DESCRIPTION
    The Sort-Object cmdlet sorts objects in ascending or descending order based on the values of properties
    of the object.

    You can specify a single property or multiple properties, for a multi-key sort, and you can select a
    case-sensitive or case-insensitive sort. You can also direct Sort-Object to display only the objects
    with a unique value for a particular property.

Popular posts from this blog

Delete files older than 365 days

I must delete IIS *.log files in  older than 365 days. D:\Logs | -W3SVC1 -W3SVC2 -... -W3SVC33 daily-delete-logfiles-older-than-365-days.cmd :: Daily delete log files older than 365 days :: Created on: 20161120 :: Created by: :: Last modified on: :: Last modified by: :: History: SET DIRLOG=E:\_scripts\Logs\ :: Echo @path to test first :: FORFILES /P D:\Logs /S /M *.log /D -365 /C "cmd /c echo @path @fdate" :: Delete files ECHO "Begin" >> %dirlog%daily-delete-logfiles.log DATE /T >> %dirlog%daily-delete-logfiles.log TIME /T >> %dirlog%daily-delete-logfiles.log FORFILES /P D:\Logs /S /M *.log /D -365 /C "cmd /c del @path" >> %dirlog%daily-delete-logfiles.log ECHO "Finished" >> %dirlog%daily-delete-logfiles.log DATE /T >> %dirlog%daily-delete-logfiles.log TIME /T >> %dirlog%daily-delete-logfiles.log :: END of script /P : Path to folder /S: recurse into subdirectories /M *.l...

Ping group on Windows with FOR command

Notes from daily work situation.

PluralSight: Free Courses

Register free account at https://app.pluralsight.com to explore these free courses.