UndergroundFun
Posts: 44
Joined: Wed Jun 17, 2015 12:57 pm

Time Sync

Fri Aug 14, 2015 1:59 pm

Has anyone gotten this to work?

Or has anyone successfully called PowerShell commands from a universal application?

UndergroundFun
Posts: 44
Joined: Wed Jun 17, 2015 12:57 pm

Re: Time Sync

Thu Aug 20, 2015 1:39 pm

I believe I've found a solution to this.

I created a text file on the Pi named "SyncTime.ps1", and put the text of the command I want to run in it "w32tm /resync /force".

Then I ran this script in PowerShell so that it would create a scheduled task that would sync the time on start up.

schtasks /Create /SC ONSTART /TN TimeSync /TR c:\SyncTime.ps1

There is a small delay when the Pi starts up before it syncs, but it is on the order of <10 seconds. This should be sufficient for what I need at the moment.

I decided it was a permissions issue with the user context that the application was running under. I was trying to find a way to assign the SeSystemtimePrivilege to the DefaultAccount, but didn't see any way to do that. I think the scheduled task runs under a different context.

BTW - DO NOT put the DefaultAccount in the Administrators group unless you want to end up re-flashing the microSD card.

Return to “Windows 10 for IoT”