I need to change the date of a server to the next day then run a sql script and then change the server date back.
I figured out how to change the server date via powershell
Invoke-Command -ComputerName $sql_box_server_name -Credential $credentials -ScriptBlock {Set-Date -date (Get-Date).AddDays(1)}
however when I need to set the date back I get an error stating there is a date/time difference between the server and client. I know this is a AD/Kerberos issue however I'm not sure how to solve it.
I tried setting the machine that runs the script's date to the same as the server however it still gives the error.
Note $credentials is set using Get-Credentials and uses Kerberos by default.