This summary of the video was created by an AI. It might contain some inaccuracies.
00:00:00 – 00:07:39
The YouTube video demonstrates using Powershell to automate service monitoring and server reboot actions. The presenter creates a function to check service status and restarts services if necessary, particularly focusing on the Apache service prone to crashing. They showcase setting up a script that can trigger a server reboot if critical services fail to start, with a scheduled task for automation. The process involves selecting log sources, setting daily script runs, and configuring Powershell commands for different actions. The video emphasizes the versatility of the script in initiating actions such as server reboots and email notifications.
00:00:00
In this part of the video, the presenter demonstrates how to restart services in Powershell. They define a function named “check service” that takes a service parameter and checks if the service is running. If the status is not running, the function attempts to start the service. A test using the Print Spooler service is conducted to show the functionality. An array containing services to be checked is created, including the Apache service which is prone to crashing.
00:03:00
In this segment of the video, the key points are as follows:
– A for each Loop is created to cycle through the name services and call the check service function.
– If the Apache service does not restart, a function called reboot server is triggered to potentially restart the server by restarting the computer.
– A separate array of key services that can trigger a reboot if they are not started is created, with a 60-second delay added before rebooting to allow the service a chance to start.
– If critical services are not in a running state, the script reboots the server to try to resolve the issue.
– To automate the script, a scheduled task is set up in the task scheduler, which can run the script at specified intervals based on triggers such as specific events in the event log.
00:06:00
In this part of the video, the speaker explains how to set up a Powershell script to check if a service is running and trigger other actions. They mention selecting the log source name and event ID, scheduling the script to run daily, setting up the actions tab with Powershell commands, including execution policy bypass and file location, and ensuring the settings meet your needs. The video concludes by highlighting that the script can be used to initiate various actions like server reboots or sending emails.