PowerShell in Intune – Run scripts (create scheduled task) (2/3)

HomeOther ContentPowerShell in Intune – Run scripts (create scheduled task) (2/3)
PowerShell in Intune – Run scripts (create scheduled task) (2/3)
PowerShell in Intune – Run scripts (create scheduled task) (2/3)
In this video, we will run a PowerShell script that creates a scheduled task that will run the System File Checker every Wednesday at 5 am.

To watch the entire series, click here: https://www.youtube.com/playlist?listPL1JNh3sw_QydkJplcrqrsc9sghCaJ40xI

We'll run the PowerShell script with Intune's built-in script runner.

Scenario:
### Create a scheduled task to run SFC/Scannow every Wednesday at 5 a.m.
### Author: John Bryntze
### Date: October 20, 2022

## Set trigger, task and settings
JBNTrigger New-ScheduledTaskTrigger -Weekly -DaysOfWeek Wednesday -At 5:00 a.m.
JBNAction New-ScheduledTaskAction -Execute /"SFC/" -Argument /"/Scannow/"
JBNSetting New-ScheduledTaskSettingsSet -Win8 Compatibility -AllowStartIfOnBatteries -StartWhenAvailable -DontStopIfGoingOnBatteries

JBNTask New-ScheduledTask -Trigger JBNTrigger -Action JBNAction -Settings JBNSetting -Description /"System File Checker runs weekly on Wednesdays at 5 a.m./"

## Create/Save a scheduled task
Register-ScheduledTask -TaskPath //JBN// -TaskName //"System File Checker runs weekly on Wednesdays at 5 a.m./" -InputObject JBNTask -User //"NT AUTHORITY//SYSTEM/"

Please take the opportunity to connect and share this video with your friends and family if you find it useful.

No Comments

Leave a Reply

Your email address will not be published. Required fields are marked *