PowerShell

Automate downloading of Youtube Channels with YT-DLP and PowerShell

Watching or listening to Youtube playlists can be very frustrating with all the ads that are being thrown at you and this seems to have gotten worse over the years. A way around this is to download your favourite Youtube playlists. You can import these into your media-server, like Emby or Jellyfin, and watch the downloaded videos on which ever screen you have setup with this server.

You can add as many playlists and channels for auto-download as you’d like. Add it to a Scheduler or Cron job to keep your local copies up to date (The script won’t redownload the already downloaded files, it checks). The size of your disk is the limit.

PowerShell

Re-Encode h264/x264 to h265 without noticeable quality loss with PowerShell and FFmpeg

Over the years I’ve gathered a lot of videos from various sources. Some of these are uncompressed and take up various gigabytes of space, each! Even though storage is getting cheaper, I don’t really want to spend €200,- (each) for 16TB spinning disks, so the answer is High Efficiency Video Coding, or HEVC/H265.
Do note that the statement above will not hold up for an uncompressed backup of a UHD Blu-ray disk. There is absolutely no way that a 50GB+ copy will have the same quality as an 1GB compressed file. The statement above is about downloaded x264 content like Youtube clips, Web-Rips, etc.

I put a PowerShell script together below to do the following:

PowerShell

Folder backups with PowerShell

Why pay for an expensive backup solution in your home-lab when you can install PowerShell for free? The script below will handle simple backups for you. You only have to add it to the Windows Scheduler or create a Cron job.

This Script’s features:
– Replicates a Source directory to a destination to be specified in the script
– Automatically creates the destination folder structure
– Identifies changes or new files in the Source folder and only copies the changed or new files files to the destination
– If a file is deleted from the source, it will move the file from the backup destination to a recycle bin folder to be specified in the script.
– The script will delete files from the recycle bin after 30 days.
– Events are logged to a logfile located in the same directory as the script. The logfile is rotated every day the script is run and are auto-purged every 90 days
– Progress indicator is displayed on the console

PowerShell

Extract various archives with PowerShell

Nowadays, instead of using .zip, .rar or .7z files, I find myself using virtual harddrives (.vhdx) more and more as it’s so much more convenient. However, extracting large amounts of compressed files, can be a very time consuming endeavor. Here a quick and dirty PowerShell script to do this. I’ve added a check for determining if the archive one folder in the root of the archive or if it contains multiple files and folders. If it contains just the one folder, the script won’t create a new folder and extract that one folder into the new folder. Instead it will “extract here”. If multiple files and/or folders are found, it will create a new folder based on the archive name. The script assumes you have 7zip installed on the default location.

Microsoft Server

Report on BlueScreen (BSOD) events and stop codes with PowerShell

A PowerShell script to report on all BlueScreen events and stop codes from the Windows Event Log on a specific server can be a useful tool for system administrators to troubleshoot and prevent future system crashes. This script will query the System Event log for events related to bug checks (BlueScreens) on a local server or a remote server.
Note: I wrote this to check for one server at a time. If requested, or if I have a future need, I may adapt it to query a list of servers and have the output written to a log file.