Windows IoT


Windows IoT Scheduled Task not running


I am trying to create a scheduled task for Windows IoT on Raspberry Pi to run on boot to check the time on an real time clock hat and then set the system time accordingly. For context, see: https://www.codeproject.com/Articles/1113626/Adding-the-Missing-Real-Time-Clock-to-Windows-IoT.
I have a PS script that runs the following:
$CurrentDate = ( c:\shares\boot\SetTimeTool.exe ) |Out-String
set-date $CurrentDate
If I run `c:\shares\boot\UpdateTime.ps1` the time is updated as desired.
I then created a scheduled task:
schtasks /create /tn "Update Time Script" /tr C:\shares\boot\UpdateTime.ps1 /sc onstart /ru SYSTEM
If I set the time to an incorrect value and reboot, the time is not changed after booted up. Also, If I try to run the sheduled task on demand:
schtasks /run /tn "Update Time Script"
I get the following response, but the time is not updated:
SUCCESS: Attempted to run the scheduled task "Update Time Script".
Any help is appreciated!
hello
Task scheduler is running from Command line and not able to handle PowerShell Scripts
you need to add a Command line script which should be executed from Task scheduler
the Command line script then executes PowerShell and your script
br
Andre
hello
Task scheduler is running from Command line and not able to handle PowerShell Scripts
you need to add a Command line script which should be executed from Task scheduler
the Command line script then executes PowerShell and your script
br
Andre
Thanks, however when I try to run the powershell script via the command line, I get the following error: The system cannot execute the specified program.
I am able to run it via powershell.
Thanks,
Tim
I've found my error, the bat file should be:
Powershell.exe -Command "C:\shares\boot\UpdateTime.ps1"
I keep getting "ERROR: Access is denied." when I try to create my startup task in command line. Any ideas why it's doing this?Connor
I keep getting "ERROR: Access is denied." when I try to create my startup task in command line. Any ideas why it's doing this?
Connor
are you logged in through ssh ?
I keep getting "ERROR: Access is denied." when I try to create my startup task in command line. Any ideas why it's doing this?
Connor
are you logged in through ssh ?
No, that was my problem, actually. I was trying to run the commands from the command line on the Raspberry Pi in the IoT Core Default App.
I had to switch to using SSH from my computer and then it worked. I guess Windows IoT must not have admin rights by default, which is why I was getting the error.Connor

Related Links

Microsoft.Maker.Serial missing in git hub clone and on git hub itself
C++ DLL for Windows IoT?
Uninstalling apps
Win 10 IoT Apps
Heap size keep growing
The code below works great if the "CoverLid_ValueChanged" signal came from an actual physical Push-button
Windows IoT Core Headed App or Browser App for basic data entry
Windows 10 IoT Skype
Anyone using BME280?
Webinterface for App
Rebuild image for downloading to flash card
First time setup: Cannot remote in to Raspberry Pi 3 box. Using Powershell (Admin)
UWP support for AMQP?
Dial-up over COM port support?
Windows 10 IoT Core API Porting Tool
Windows 10 IoT Core Installation Not Detecting eMMC

Categories

MSDN
Windows Desktop Develo...
Visual Studio Design a...
Commerce Server
Microsoft Sync Framework
SQL Server (Pre-release)
WebsitePanel
Bing Maps
Office Live Development
Exchange Server
Lync Server
Microsoft Azure
Archived Forums C-D
Archived Forums T-U
Archived Forums W
Microsoft Partner Center
Software Entwicklung f...
Open source Developmen...
Off-Topic Posts (Do No...
Visual C++
Testing with Visual St...
Windows App Studio Beta
Windows Desktop Develo...
Peer-to-Peer Networkin...
Windows Desktop Sideba...
Windows Filtering Plat...
SharePoint 2010 - Deve...
SharePoint 2010 - Usin...
Azure CDN
Azure DocumentDB
Azure Functions
Azure Log Integration
BizTalk Server Adapter...
Internet Explorer Web ...
SyncFx - SyncToy-File ...
Microsoft Robotics - C...
Visual Studio Smart De...
SQL Server Tools
SQL Server Replication
SQL Server Data Qualit...
Standard 2009: Embedde...
SQL Server 2012 Databa...
SQL Server 2012 SQL To...
Windows Forms General
Windows Forms Sample A...
WebsitePanel - Support
Office Live Basics, Es...
Exchange Server Protocols
Project Server - Setup...
Microsoft Unified Comm...
Silverlight 4
Programming Silverligh...
Report a Silverlight Bug
Silverlight for Window...
Expression Design
Retired SharePoint Acc...
.NET Remoting and Runt...
CHESS – Find and Repro...
Commerce Server 2002 a...
Deep Zoom Composer
Dryad, DSC, and DryadL...
Dynamic Languages on .NET
Feedback for Visual Ba...
Game Technologies: XNA...
General Troubleshootin...
General Windows MultiP...
(Retired) Exchange Pre...
MS-Build, Multi-Target...
Monitor, Alert and Aut...
Popfly Explorer
Search Server: Frequen...
Search, Organize, and ...
Server Core Developers
Silverlight (formerly ...
Surface Application De...
SQL Azure Labs Support
Tools for Windows Phon...
Visual Basic Language
Visual Basic Power Packs
Visual C# Express Edition
Visual Studio 2008 SP1...
Visual Studio Tools fo...
Visual Studio Web Perf...
Web Gadget Development
Windows Workflow Found...
Building Windows Store...
Expression Blend for W...
XML in Visual Studio a...
XML in Windows (MSXML ...
XNA Framework
OneDrive Development (...
Kinect for Windows v2 SDK
SQL Server 2016 Preview
Windows IoT

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile