Friday, May 9, 2014

Everyday Powershell - Part 20 - Rollback system time and launch a program

So there are times where loading an older application requires you to rollback the date of your system. Our UPS management console has had this odd requirement since 2014. So we threw this together to make life a little easier;

set-date 01/01/2009
Start-Process "c:\windows\system32\notepad.exe"
Start-sleep 15
set-date (invoke-command -ComputerName SOMECURRENTTIMESERVER -ScriptBlock {get-date})

You can update the process path in the second line, then save this as a .ps1 file and use it as a shortcut to launch time-bombed applications.

It does require the appropriate permissions on the sever we get the time from in the fourth line. It'll also need Powershell Remoting enabled.

1 comment:

  1. Thanks Occasianal Utility Guy, this is exactly what I needed

    ReplyDelete