Things used in this project

Software apps and online services:
10
Microsoft Windows 10 IoT Core

Code

StartupScript.ps1Powershell
PowerShell script that is to be run at startup of the Windows IoT Core OS.
# startup script
$logFile = 'C:\startupLog.txt'
get-date >> $logFile
Startup.batPlain text
Batch file that is called from the scheduled task. Executes the PowerShell file.
powershell -command "C:\StartupScript.ps1"
PowerShell Remote Execution PolicyPowershell
Setting the Remote Execution Policy so that PowerShell scripts can be run.
Set-ExecutionPolicy RemoteSigned
(Optional) Permanently Adding System32 to the System PathPlain text
Permanently Adding System32 to the System Path
setx PATH "%PATH%;C:\Windows\System32"
Creating a scheduled startup taskPlain text
Creating a scheduled task on Windows IoT Core to execute a batch file upon startup.
schtasks /create /tn "Startup PowerShell" /tr c:\Startup.bat /sc onstart /ru SYSTEM
Deleting a Scheduled TaskPlain text
Deleting a Scheduled Task
schtasks /Delete /TN "Startup PowerShell"
Running a scheduled taskPlain text
If you want to test out your task, you can run it from the command line
schtasks /Run /tn "Startup PowerShell"

Credits

Photo
Carey Payette
11 projects • 113 followers
Sr. Software Engineer at Independent
Contact

Comments

Add projectSign up / Login