This seems to work mostly OK. Put in your server name and credentials (lines 8-12) and give it a try. I say mostly because I'm getting a blank line at the end of the CSV file. Not sure why that happens.
More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.
Then you just need to pass your date to the function.