Objects

A very cool tip was displayed on the website powershell

The code is to alter an object to do some calculations, in this case the age of files in days of a directory

$age = @{Name='Age';   expression={ (New-TimeSpan $_.LastWriteTime).Days }}
dir $env:windir |   Select-Object name, $age |   Export-CSV c:\test.csv

On Me
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License