Automatic stock update during a working day
Automated updating of the inventory
It is possible to automate the upload using an additional script. The script creates a task in the Windows task scheduler that automatically executes the upload script on a daily basis.
Automation through Windows task scheduler
The following script for PowerShell ISE creates an automation through the Windows Task Scheduler, so an upload no longer has to be started manually.
PowerShell Script (.ps1)
# This script creates a scheduled task that executes the upload script every day at 8:00 am.
# Path to the upload script (please customize)
$uploadSkript = "C:\Users\ExampleName\ExampleLocation\Folder\Example_Upload_Skript.ps1"
# Name of the planned task (name can be freely chosen)
$taskName = "CSVUpload_daily_8am"
# Time of the daily start (24-hour format)
$startTime = "08:00"
# --- Create the task ---
# Define the action: Start PowerShell to execute the upload script.
# It is started without profile and with Bypass-ExecutionPolicy, so that any policies do not prevent execution.
$action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -File `"$uploadSkript`""
# Define the trigger: Daily at the specified time
$trigger = New-ScheduledTaskTrigger -Daily -At $startTime
# Define the user context. The currently logged in user is used here.
# If you want to run the task under a different user (e.g. SYSTEM), adjust the -UserId parameter accordingly.
$principal = New-ScheduledTaskPrincipal -UserId $env:USERNAME -LogonType Interactive
# Register the planned task. The -Force parameter overwrites any existing task with the same name.
try {
Register-ScheduledTask -TaskName $taskName `
-Action $action `
-Trigger $trigger `
-Principal $principal `
-Description "Automatic CSV upload daily at 8:00 a.m." `
-Force
Write-Host "Scheduled task ‘$taskName’ was successfully created." -ForegroundColor Green
} catch {
Write-Host "Error when creating the planned task:" -ForegroundColor Red
Write-Host $_.Exception.Message -ForegroundColor Yellow
}