Monday, October 27, 2008

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.

Summary:
----------------------
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".
----------------------