Hi @ti1 embracon ,
with the (get-date).AddDays(1)
you get the date and time informationen.
I am not 100% sure if Backup-SqlDatabase
is able to work with the time information.
You can try this to get the date information only:
$Expira = (get-date).AddDays(1).Date
Backup-SqlDatabase -ServerInstance $Instancia -Database $Banco -BackupFile $NomeArquivo -Credential $Credential -BackupAction Database -CompressionOption On -ExpirationDate $Expira -Initialize
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Andreas Baumgarten