Backup-SqlDatabase ExpirationDate parameter bug - by Arnaud Fontenoy

Status : 

  Won't Fix<br /><br />
		Due to several factors the product team decided to focus its efforts on other items.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 790545 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 6/20/2013 3:25:16 AM
Access Restriction Public


I've been struggling for days to use this parameter.
In the help it is said that it is a DateTime parameter, but when giving a datetime, I recieve an error saying that only datetimes are accepted :(
for instance :
$dte = Get-Date
$dte = $dte.AddDays(7).
Backup-SqlDatabase [...] -ExpirationDate $dte fails.

Then I tried with a string representing a date, like "2013-09-01".
No error anymore ! But it seems that the month (09) and day (01) are inverted when I look in the support in SQL Server.

When trying with "2013-13-09", I get an error saying that it can't be converted into a valid date/time. So I think Powershell can't obviously convert it, and I can anderstand it.

When trying with "2013-09-13", I get an error saying that it's not a valid value for parameter EXPIREDATE.

As a conslusion, I think there is a bug in the snippet :
- It tries to convert first the string as a date/time in powershell (I think it is OK)
- Then it should be converted inside an SQL Server Date/Time, but there is an inversion between MONTH and DAY.
Sign in to post a comment.
Posted by Microsoft on 7/2/2013 at 2:33 PM
Hello Arnaud. Thank you for bringing this to our attention. We really do appreciate the feedback. We’ll investigate and get back to you.

-Walter A Jokiel, Program Manager, SQL Server (