title: Powershell Getting the nth day of the month
body: <p>I have this script which I found on the internet to calculate the third Tuesday of every month - but I need to modify it to simply give me the 7th day of the month, and the same but plus any number of days).</p>
  
  <pre><code>            $FindNthDay=3
              $WeekDay='Tuesday'
              [datetime]$Today=[datetime]::NOW
              $todayM=$Today.Month.ToString()
              $todayY=$Today.Year.ToString()
              [datetime]$StrtMonth=$todayM+'/7/'+$todayY
              while ($StrtMonth.DayofWeek -ine $WeekDay ) { $StrtMonth=$StrtMonth.AddDays(1) }
              $StrtMonth.AddDays(7*($FindNthDay-1))
              $NextUpdate = $StrtMonth.AddDays(7*($FindNthDay-1))
  </code></pre>
  
  <p>I'm not understanding the logic here, I guess I don't need $Weekday. any ideas? I'd like to keep to the similar structure and variable names where possible in order to keep it consistent with the other scripts.</p>
  
  <p>Thanks</p>