Reputation: 157
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.
Upvotes: 1
Views: 988
Reputation: 722
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:
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\EmbeddedMode\ProcessLauncher" /v AllowedExecutableFilesList /t REG_MULTI_SZ /d "c:\windows\system32\ipconfig.exe"\0"c:\windows\system32\tlist.exe"\0"c:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe\0"
Go ahead, run the command above on your device, using SSH or PowerShell. after that you authorize to access this apps and files.
Note :
ProcessLauncher
API launches executables under the current user credentials, or DefautlAccount, so apps requiring admin priviliges will fail to run properly.
see this link for more details :
https://ms-iot.github.io/content/en-US/win10/samples/ProcessLauncherSample.htm
Upvotes: 1
Reputation: 436
I don't think this is possible, out of the box, for security questions.
Upvotes: 0