我正嘗試在樹莓派(uwp)上運行powershell腳本以通過c#更改系統時鐘。通過ProcessLauncher更改系統時鐘uwp
運行下面的代碼會拋出異常'System.UnauthorizedAccessException'。
await ProcessLauncher.RunToCompletionAsync(..."set-date.ps1", date.ToString());
設置date.ps1文件內容:
function Set-Time ([string]$dateTime) {
$newDate = Get-Date $dateTime
Set-Date $newDate
}
我試圖尋找其他辦法做,或嘗試運行ProcessLauncher內冒領,但我不知道該怎麼辦它在uwp上。
根據微軟:「注意,ProcessLauncher API啓動可執行文件下的當前用戶憑據,或DefautlAccount,所以應用程序需要管理員特權時將無法正常運行。」
任何幫助改變系統時鐘?
謝謝。
你找到一個解決這個問題?運行https://github.com/ms-iot/samples/tree/develop/ExternalProcessLauncher/CS解決方案時出現同樣的錯誤。 –