Command Shell: Set-MaintenanceWindow with an end time of now

Reported on MS Connect HERE.

I view this more as an issue. Please vote if you come across this problem by following the link above. There is a bit more information if you follow the link also.

When a maintenance window has been created, if “Set-MaintenanceWindow -endtime $(get-date)” is used, it will output an error:
Set-MaintenanceWindow : Cannot set scheduled end time to a time in the past

There seems to be a small delay in processing the command, simply doing this works:
Set-MaintenanceWindow -endtime $(get-date).addseconds(1)

The cmdlet should gracefully accept a end time of “now”.

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>