I'm trying to run a powershell script on raspberry (uwp) to change the system clock by c#.
Running the code below throw an exception 'System.UnauthorizedAccessException'.
await ProcessLauncher.RunToCompletionAsync(..."set-date.ps1", date.ToString());
set-date.ps1 file content:
function Set-Time ([string]$dateTime) {
$newDate = Get-Date $dateTime
Set-Date $newDate
}
I'm trying to find other way to do it or try to run ProcessLauncher inside impersonator, but i don't know how to do it on uwp.
According Microsoft: "Note, ProcessLauncher API launches executables under the current user credentials, or DefautlAccount, so apps requiring admin priviliges will fail to run properly."
Any help to change system clock?
Thank you.
I don't think this is possible, out of the box, for security questions.
You must be Add application with below code to add those in AllowedExecutableFilesList registry in windows Iot core , so you need use below command to add applications or files to AllowedExecutableFilesList Key in windows registry:
Go ahead, run the command above on your device, using SSH or PowerShell. after that you authorize to access this apps and files.
see this link for more details :
https://ms-iot.github.io/content/en-US/win10/samples/ProcessLauncherSample.htm