Please give me a script in powershell that restarts the computer daily at 3am
- User
Please give me a script in powershell that restarts the computer daily at 3am
Assistant
Here is a PowerShell script that will restart the computer daily at 3am:
bash# Create a new Windows Task Scheduler job $job = New-ScheduledTaskAction("powershell.exe", "RestartComputer") $job->Triggers = New-ScheduledTriggerAction("System.Eventing.ScriptAnalytics.PowerShellScriptTrigger", "IsDaysInRange", [int]$daily) $job->StartTime = "3:00 AM" $job->Ending = "3:01 AM" # Create the task and save it $task = New-ScheduledTask($job) $task | Set-ScheduledTaskActionNote: This will restart the computer every day at 3:00 AM. If you want to change the time, you can change the values in the Triggers section.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.