Powershell – Getting Formatted Date Info

This is a simple one, want to get today, yesterday, last month or last year .. try this $Date = Get-Date $Today = $Date | Get-date -Format MM/dd/yyyy $Yesterday = $Date.AddDays(-1) | Get-Date -Format MM/dd/yyyy $LastMonth = $Date.AddMonths(-1) | Get-date -Format MM/dd/yyyy $LastYear = $Date.AddYears(-1) | Get-Date -Format MM/dd/yyyy You… Continue reading