Тёмный

PowerShell in Intune - Run Scripts (Create a Scheduled Task) (2/3) 

Intune & Vita Doctrina
Подписаться 4,9 тыс.
Просмотров 7 тыс.
50% 1

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

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 33   
@adkhan123456
@adkhan123456 Год назад
You're getting my favourite teacher in intune winapp 32. Love it !!
@IntuneVitaDoctrina
@IntuneVitaDoctrina Год назад
Thanks a lot Adeel, I got a video serie on howto package Win32 app that explains more in details all the steps ru-vid.com/group/PL1JNh3sw_Qyc9Zt8rah7QP1vAY0X6An79
@ibrahimabdeltawab6418
@ibrahimabdeltawab6418 Год назад
So helpful! Thanks so much
@rashkaViking
@rashkaViking Год назад
I like always the way you present these tutorials. NICE JOB!
@IntuneVitaDoctrina
@IntuneVitaDoctrina Год назад
Thanks again @Abdirashid Muhammed the third video in the Intune PowerShell serie is already recorded since some days ago but not fully edited yet, will be published in the coming days ASAP :)
@woodychiu589
@woodychiu589 6 месяцев назад
I noticed that the scheduled task running fine but then, the next run time will be added one hour on top of the scheduled time. I also noticed it could be because the "Synchronize time across zones" inside the "Edit Triggergor" got turned on by default. Any idea how to script it to be off?
@IntuneVitaDoctrina
@IntuneVitaDoctrina 6 месяцев назад
Thanks for mentioning, never thought of that, strange seems to work even though it runs during "bad" timing depending on time zone, I'm close to UTC time zone but my friends in America/Asia is not, will check this. found this that has a work around: www.thecliguy.co.uk/2020/02/09/scheduled-task-trigger-synchronize-across-time-zones/
@texddiaz
@texddiaz Год назад
thanks for share, great video! :)
@mr.choice86
@mr.choice86 2 месяца назад
Nice video! Does intune knows it already ran on a system and will that prevent it from running multiple times? In the previous video where you created an app, we could have a way to verify wether the program was already installed. I simply need to add a line to the hosts file. I could create an install script as an app in you previous video. Let it do my job and also add an extra value (file, reg key) to verify a succesful run. Or I could just use a script like this video which is easier. But I don't want the system to run it over and over again. I can also have my script check if the value already exists before adding it. Which option would you use?
@mr.choice86
@mr.choice86 2 месяца назад
I should have seen your next video about remediatons before asking this question😅
@IntuneVitaDoctrina
@IntuneVitaDoctrina 2 месяца назад
Haha but good question still 😃 Seems you could use both, normal script that looks if hosts file got your entry.. if not add it. Or break out to a remediation script and have the check for the entry in detection script and exit with 1 if missing and then have the rest of your script in a remediation script.
@mr.choice86
@mr.choice86 2 месяца назад
@@IntuneVitaDoctrina I have chosen to use the script (platform script) instead. Remediation script would be a lot nicer, but it requires a license that is probably not included with business premium :(
@IntuneVitaDoctrina
@IntuneVitaDoctrina 2 месяца назад
true! forgot about that license, but since you got it more or less working with normal script that be fine :)
@STILOGIntune
@STILOGIntune 7 месяцев назад
Nice one, tested myself but it's not working on my environment. requires elevated rights.
@IntuneVitaDoctrina
@IntuneVitaDoctrina 7 месяцев назад
thanks, did you run the PowerShell script in Intune as SYSTEM? then it should have enough permission
@STILOGIntune
@STILOGIntune 7 месяцев назад
@@IntuneVitaDoctrina I believe i did but i might have done it wrong ? $trigger = New-ScheduledTaskTrigger -Weekly -WeeksInterval 2 -DaysOfWeek Friday -At 1pm $action = New-ScheduledTaskAction -Execute “C:\Program Files (x86)\Dell\CommandUpdate\dcu-cli.exe” -Argument “/applyUpdates -silent -reboot=disable -outputlog=c:\driversupd\log.log” $settings= New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries $Task = New-ScheduledTask -Trigger $trigger -Action $action -Settings $settings Register-ScheduledTask -TaskPath \Intune\ -TaskName "Intune Driver Updates x86" -InputObject $Task -User "NT AUTHORITY\SYSTEM"
@STILOGIntune
@STILOGIntune 7 месяцев назад
Yes, i modified my script to use -User " ... " like you showed. i tried generating a folder to test if the script was at least run, and it does
@IntuneVitaDoctrina
@IntuneVitaDoctrina 7 месяцев назад
Dell Command Update, great tool love it, that for sure you can make it work, I have a similar setup running dcu-cli.exe, Let me check this on Wednesday and let you know, I see you got a program files x86 path so the switch to run 64-bit should maybe be changed, look more later but 100% you can make this happen, could be a good video for my channel also :)
@STILOGIntune
@STILOGIntune 7 месяцев назад
@@IntuneVitaDoctrina Thanks a lot ! I kept default path and chose to create a second task for the x64. I had a strange behavior where for some devices Dell Command update install in x86 or x64 and i couldn't figure why.
@lynetteberg4807
@lynetteberg4807 Год назад
I just increased my dings to ALL. I actually watch allot of your stuff as i'm fairly new to Intune, but no one else knows that because I watch allot of videos. I even recommended you to a friend.
@IntuneVitaDoctrina
@IntuneVitaDoctrina Год назад
Thank you so much Lynette, that makes my days to hear that, thanks a lot. More Intune videos are coming :)
@lynetteberg4807
@lynetteberg4807 Год назад
@@IntuneVitaDoctrina Looking forward to it. Really, I am.
@nagarajbhat6606
@nagarajbhat6606 Год назад
Excellent 👍
@IntuneVitaDoctrina
@IntuneVitaDoctrina Год назад
Many thanks Nagaraj! I have recorded a cool video about using WinGet in script to deploy software also, it should be publish in about a week from now I hope once edit, think you will like that also.
@nagarajbhat6606
@nagarajbhat6606 Год назад
@@IntuneVitaDoctrina appreciate your honesty in sharing wonderful and useful contents ☺️
@soundarya9195
@soundarya9195 11 месяцев назад
I have a powershell script which is need to create a text file on the client system is that possible in intune
@IntuneVitaDoctrina
@IntuneVitaDoctrina 11 месяцев назад
That is possible. If you have a finished file and just copy, you can put the file in a Win32/intunewin file and then in the script copy it. If it is just an empty file or litte text you can just run a normal PowerShell script that creates the file for you.
@soundarya9195
@soundarya9195 11 месяцев назад
@@IntuneVitaDoctrina it can't created text file in my system Is there any admin permission can block it or what may be the issue
@IntuneVitaDoctrina
@IntuneVitaDoctrina 11 месяцев назад
Intune got pretty much all permissions needed. Where do you want to create the file? c:\windows\system32\etc... if it is a new file it should be pretty straight forward, if update existing it can be locked, maybe need to stop a service first etc...
@dineshchaudhary2918
@dineshchaudhary2918 6 месяцев назад
-user "NT Authority \system" meant this task ran on a system not user, right ?
@IntuneVitaDoctrina
@IntuneVitaDoctrina 6 месяцев назад
good question, and yes totally so, that means it run as SYSTEM and got super power rights :)
Далее
🦊🔥
00:16
Просмотров 584 тыс.
Configure Windows LAPS in Intune
34:29
Просмотров 3,9 тыс.
Civilization 1 - Full Earth Game Play (Emperor Level)
2:47:38
Intune Proactive Remediations + Winget.exe = Love
41:25