PowerShell Scheduled Task Creation Script

PowerShell Scheduled Task Creation Script

Model: GPT-4
Difficulty: Advanced
Upvotes: 0
automationITPowerShellscheduled taskWindows

โ€” Prompt โ€”

Write a PowerShell script that creates a scheduled task to run [script/exe] every [interval]. Must include: triggers, action, user context, and error logging.

Why It Works

Bulletproof way to automate recurring jobs, central to fleet management.

Example Output

Task: Run backup.ps1 daily at 2am. Script: Register-ScheduledTask. Log: C:TaskLog.txt.