Restart Windows in 1 hour or certain time

tldr;

  • Open Powershell as Admin
  • Type: Start-Sleep 3600 ; Restart-Computer -Confirm:$false <enter>

 

I work on RDP a lot against Windows Machines and sometimes there are updates and downloads what I need to do and afterwards update. Or perhaps I need to restart in certain time.

Basically what start-sleep does is pause the process for the number of seconds that you specify. The semicolon is like having another line in the code so it will execute what is next, which in this case is restart-computer. Since you may not be logged into the server or it may be at a lock-screen, you will need to include the -confirm:$false otherwise it may not execute.

If you want to restart on certain time

  • shutdown -r -t ([decimal]::round(((Get-Date).AddDays(1).Date.AddHours(3) - (Get-Date)).TotalSeconds))

This will get the number of seconds between the time the script is ran and 3:00AM the following day (on the server time). It then passes the result to shutdown.exe. Obviously this is designed to be ran before midnight. Remember “-r” so it is actually restarting instead of just shutting down.

Advertisements

Xcode 9 and Xcode 10 Side-by-side

I have been working on Ionic 4 project recently and I hit to wall because since Cordova has compatibly issues with the latest Xcode (10). After headaches with compiling the iOS project I returned to great Ionic documentation about iOS setup where it of course clearly says on the top:

We recommend using XCode 9. Xcode 10 support in Cordova is still a work-in-progress. See this issue for details.

So, yes. You need Xcode 9 if you want to work on Corova still (as writing in Feb 8 2019.) Luckily it is possible to run multiple versions of Xcode on the same machine. You simply need to copy additional versions to Applications with different name. Like this: