In this video, we will run a PowerShell script that creates a Scheduled Task that will run System File Checker every Wednesday at 5am.
To see the whole series check here: • Intune - Three ways of...
We will run the PowerShell script with Intune's built-in Script runner.
Script:
Create Scheduled Task to run SFC /Scannow each Wednesday 5am
Author: John Bryntze
Date: 20th October 2022
Set Trigger, Task, Settings
$JBNTrigger = New-ScheduledTaskTrigger -Weekly -DaysOfWeek Wednesday -At 5:00am
$JBNAction = New-ScheduledTaskAction -Execute "SFC" -Argument "/Scannow"
$JBNSetting = New-ScheduledTaskSettingsSet -Compatibility Win8 -AllowStartIfOnBatteries -StartWhenAvailable -DontStopIfGoingOnBatteries
$JBNTask = New-ScheduledTask -Trigger $JBNTrigger -Action $JBNAction -Settings $JBNSetting -Description "System File Checker weekly Wednesday run at 5am"
Create/Register Scheduled Task
Register-ScheduledTask -TaskPath \JBN\ -TaskName "System File Checker weekly Wednesday run at 5am" -InputObject $JBNTask -User "NT AUTHORITY\SYSTEM"
3 окт 2024