powershell-training-material

Chapter 7 | Selecting Your Own Custom Property

Get-ChildItem C:\Windows\System32\ | Sort-Object Length -Descending | 
Select-Object @{name="Size(MB)";expression={$_.Length / 1MB -as [int]}} -First 10 | 
Format-Table -AutoSize

image

Get-ChildItem c:\windows\system32 | select @{n="Last Modified Date";e={$_.LastAccessTime.tostring("yyyy-dd-MM")}}, FullName, mode -first 10

image