Automate your PowerShell scripts with Windows Task Scheduler

Automate your PowerShell scripts with Windows Task Scheduler

Shane Young

6 лет назад

131,235 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Yeu Harng
Yeu Harng - 26.09.2023 11:56

Hi, if i have 11 ps1 file how can i run it everyday, how to write it?

Ответить
Pablo Andrés Herrera Torres
Pablo Andrés Herrera Torres - 08.09.2023 01:01

What if the location from the ps1 scrip is in another server, should I use as argument \\servername\folder\.ps1 or how should I put there? Thank you in advance.

Ответить
Dennis van Dinter
Dennis van Dinter - 30.07.2023 10:13

So I have this strange problem with running a Powershell script with a scheduled task. The task will trigger on a 1074 event ID (event ID for shutdown or reboot). If I shutdown the task will run and execute the script. If I reboot the task will run, but after reboot the comment says the task was started but was interrupted by the user. It gives error code 2147943515.

Someone any ideas?

Ответить
venom media's
venom media's - 12.06.2023 10:07

how can i set it for every 5 mins ??

Ответить
Vikas Rajbhar
Vikas Rajbhar - 07.04.2023 17:41

Thank you for the Video

Ответить
Cuando quedábamos para jugar.
Cuando quedábamos para jugar. - 03.04.2023 10:43

Mate, i know its been 5 year now, but i have to try. I have the following script:
Get-WmiObject -Class "Win32_NTLogEvent" -Filter "Logfile='System' OR Logfile='Application' AND TimeGenerated >= '20230301000000.000000-000' AND TimeGenerated <= '20230331000000.000000-000'" | Select-Object LogFile, Type, Category, EventCode, TimeGenerated, @{Name="Message"; Expression={$_.Message.Split("`r`n")[0]}} | Where-Object {$_.Logfile -eq 'Application' -or $_.Logfile -eq 'System' -and $_.Type -eq 'Error' -or $_.Type -eq 'Crítico'} | Export-Csv -Path "C:\Users\Korven\Desktop\PepitoG\Visor de eventos\EventosMarzo.csv" -NoTypeInformation

This will take from the event viewer the logs from the system and applications from March, and export them into a .scv file

I tested it in PowerShell and it worked. But it doesnt work if i put it on the taskprogrammer. So, obviously i check if i misspell any letter. Is this kind of script too much to handle on the task programmer maybe?

Ответить
James White
James White - 01.03.2023 20:58

You da man! This video was awesome. New sub B^)

Ответить
Yannick
Yannick - 15.02.2023 21:33

And does it matter whether the client is turned on or not?

Ответить
lashley tyler
lashley tyler - 08.11.2022 21:45

thanks

Ответить
venkatesh Venky
venkatesh Venky - 07.10.2022 07:32

Tq bro

Ответить
VlogsBaleneoRS
VlogsBaleneoRS - 17.09.2022 07:44

How do we add the hostname on the text file using the Powershell

Ответить
Alpha Omega
Alpha Omega - 16.09.2022 07:05

Nice video. Just wanted to know how to take the current config back up

Ответить
Luca D
Luca D - 19.06.2022 12:39

Hi save option is greyed out for me - any idea why? Thanks

Ответить
corey burke
corey burke - 31.05.2022 06:31

is there a way to tell it to start a certain line on the script after logon so you don't rerun what's already completed?

Ответить
PerilGG
PerilGG - 22.03.2022 10:59

every 10 mins d b scheduler pops up and it ruins my gaming, i try deleting it and stopping it and everything on task scheduler and no matter what i do it comes back, i dont know what to do

Ответить
Mera
Mera - 05.03.2022 05:59

Love your tutorials and I'm new at this! Can you share how to do a full and incremental backup using PowerShell for simple folder backup? Thank you!

Ответить
multitaskprueba1
multitaskprueba1 - 14.02.2022 08:28

Thank you for the video! You are a genius!

Ответить
mario franco
mario franco - 31.01.2022 17:30

Thanks!!

Ответить
Manjunatha Manju
Manjunatha Manju - 19.01.2022 09:42

Easy and nice. How can we automate email report.

Ответить
Nim Studios
Nim Studios - 06.01.2022 21:24

How to run a PS script daily as a service account, please?
And it should not have any human intervention.

Ответить
Scott Wood
Scott Wood - 19.12.2021 20:32

Thanks Shane, perfect working example ‘beginners intro’ to Windows Task Scheduler!

Ответить
Michael
Michael - 16.12.2021 06:51

Hi Shane, not sure if you check old comments but here goes.
I've got a parameterised PS script with a username and password that I want automated but I don't want to have my password in plain text within my script for security reasons. Any tips about this?
Thanks, great video.

Ответить
Pols Logan Guntakala
Pols Logan Guntakala - 10.12.2021 14:29

Hi shane! This video is really useful.I want to set a task scheduler using powershell script. It has to trigger weekly once. It has to give prompt to users reboot the device. Could you please help me with this how to write a script for this.

Ответить
Wahaj Khan
Wahaj Khan - 08.11.2021 16:36

Shane can you make a video on how to ping multiple machines and get the services of the machines like windows uptime and windows update in powershell

Ответить
Dadimi Bhaskar
Dadimi Bhaskar - 29.10.2021 14:22

Guides to us super and Tqx.

Ответить
apolomachine
apolomachine - 01.09.2021 15:33

Thanks man!, this video really help me!

Ответить
glenr
glenr - 26.08.2021 11:06

Thanks mate, that's realy cool

Ответить
Sexy old Geraldo Rivera
Sexy old Geraldo Rivera - 24.08.2021 12:38

Thanks man! Exactly what I needed.

Ответить
Ravi Premani
Ravi Premani - 19.07.2021 19:11

So here is my requirement
First please help me with the script to launch Visual Studio Test from powershell using windows scheduler
Second, I want to intentionally stop that test case close the desktop app on which I am performing automation and invoke it again
This should happen in every half an hour
So it should keep doing this process like an infinite loop

Ответить
only sub
only sub - 13.07.2021 18:32

What if I want to run the script with Admin rights? any way to pass that cmdlet into Task Scheduler rather than inserting it into the script itself.

Ответить
Tony Uketui
Tony Uketui - 05.07.2021 16:02

Hey Shane

Please could you do a video that creates a task scheduler with a bash script

Ответить
Ram Chandran
Ram Chandran - 20.06.2021 19:27

Thanks Shane !

Ответить
Adrian Mc
Adrian Mc - 10.06.2021 21:38

This was the answer I was looking for. Thank you :)

Ответить
Mahesh Muliya
Mahesh Muliya - 21.05.2021 18:53

Thanks

Ответить
Pankaj Shinde
Pankaj Shinde - 04.05.2021 18:10

Hi Sir,
How can I use power shell to write down PC Lock time and PC unlock time in any of the text applications?

Ответить
Dea Del Rosario
Dea Del Rosario - 04.03.2021 22:11

Hello Shane! Awesome videos - I'm learning a lot from you! :) Would like to ask how can I get multiple output files so everytime the task runs my powershell script via task manager, it won't overwrite the existing one? I am trying to get the list of logged in users in the RDS server per hour. So I need a new output file everytime the task runs. Is that possible? Thank you so much! :)

Ответить
Микола Хуткий
Микола Хуткий - 28.02.2021 12:45

Hi, I have a task for PowerApps when the application starts, I need to get information about the computer from which the application is launched.
Is it possible to use Power Shell (script) + Power Automate + Power Apps ...
if it is technically possible, tell me where to look or maybe there is an opportunity and you will share the script like this :)

Ответить
Andres Rodriguez
Andres Rodriguez - 27.02.2021 17:37

Thank you!

Ответить
H C
H C - 01.02.2021 00:00

Thanks Shane for this lovely and simple to understand intro to executing PS script from windows task scheduler. I am completely new to PS scripting so please bear with me. From this video, I noticed that when setting up the "Action" tab, you did not use the syntax "-File" before the path to where your PS1 script (Add arguments (Optional)) is located. Though i have seen other forum and videos specified the use of this. Are you able to explain when you might need to use this please? Also, I am looking for an intro to subject incorporating the task scheduler whereby new files are monitored via PS scripts and send notification via emails on scheduled timetable. Would you have such video in your gallery please? Many thanks|!

Ответить
Dave Peat
Dave Peat - 25.01.2021 15:33

hi Shane i have been trying to copy folders in the same way but it is not working for me so i have just copied exactly what you have done and it is not completing the script both your script and mine both work if i just run them in powershell would you have any suggestions as i am new to powershell and task scheduler and can't help but think i am missing something simple sorry and
thanks in advance if you can

Ответить
Donnie Lewis
Donnie Lewis - 13.01.2021 05:54

So what if you PowerShell is looking for input. Select A for all?

Ответить
Kelvin W. Kiger
Kelvin W. Kiger - 17.12.2020 20:16

Thank you Bro!

Ответить
Akshit Dhariwal
Akshit Dhariwal - 26.11.2020 13:00

Hi Shane for me everything working task is being creating but whenever it run it didn't show the file updated as if not run

Ответить
Héctor D.
Héctor D. - 16.11.2020 19:00

'That's right, dedication here, we are making this video on a saturday', take your like good sir.

Ответить
dowhatIdo
dowhatIdo - 04.11.2020 02:32

Heyy do you know how to run shutdown program at certain time
Let just say for 8 hours. So evertime somwone turn on the PC it will turn off automatically.

Ответить
suresh kumar
suresh kumar - 31.10.2020 23:53

I want to put an alert email when a particular task success/fails and last run time of that task scheduled by task scheduler . Help me please

Ответить
Ramakant Thorat
Ramakant Thorat - 30.10.2020 10:53

It is possible to run powershell with admin access from task scheduler?

Ответить