VMware Cloud Community
medalklector
Contributor
Contributor
Jump to solution

Determine End Of Month and then run script

Hi All,

Ok, I'm stumped. I can get all manner of date data..but I have not located a way (or even example script) that shows how to retrieve the end of the month.


Why?


I have a master script that runs as a scheduled task. It runs every day and calls other scripts depending on the date. It's fine for things like weekly reports as I just use $dow = {get-date}.DayofWeek but I need to run month end scripts.

I can pop something together that gets the day and then performs some ugly logic based on < or > but I'm sure there is a slicker way to do it.

As always, any help greatly appreciated.

Cheers

Reply
0 Kudos
1 Solution

Accepted Solutions
mattboren
Expert
Expert
Jump to solution

Hello, medalklector-

One way to do it it is described by RMToups, Jr. at http://activelydirect.blogspot.com/2011/01/determine-last-day-of-month-in.html.  You should be able to adjust the output to fit your requirements.  How does that do for you?

View solution in original post

Reply
0 Kudos
2 Replies
mattboren
Expert
Expert
Jump to solution

Hello, medalklector-

One way to do it it is described by RMToups, Jr. at http://activelydirect.blogspot.com/2011/01/determine-last-day-of-month-in.html.  You should be able to adjust the output to fit your requirements.  How does that do for you?

Reply
0 Kudos
medalklector
Contributor
Contributor
Jump to solution

Excellent - Thanks very much. That is what I was looking for.

Cheers

Reply
0 Kudos