I have had a few head scratching sessions with variables not being the type that I thought they were.
$myDate = Get-Date
does not always yield a date type for me. Sometimes it yeilds type string for me. So $myDate.dayofWeek is a null.
I am not sure how this happens. I got around it by statically declaring the type. What do most people do?