I am trying to use the Get-Date cmdlet to get the date of the day. I found the .AddDay (-1) command and it seems to work. The next thing I need to do is retrieve the date in YYMMDD format. This is the part that I cannot figure out how to do this.
This is what I used to get today's date and previous day.
$a = Get-Date
"Day: " + $a.Day
"Month: " + $a.Month
"Year: " + $a.Year
"Hour: " + $a.Hour
"Minute: " + $a.Minute
"Second: " + $a.Second
$b=$a.AddDays(-1)
"Day: " + $b.Day
"Month: " + $b.Month
"Year: " + $b.Year
"Hour: " + $b.Hour
"Minute: " + $b.Minute
"Second: " + $b.Second
source
share