Skip to content

Instantly share code, notes, and snippets.

@psitem
psitem / Set-NotificationIconsVisible.ps1
Last active March 22, 2024 09:27
Sets all Windows Taskbar Notification Icons to Visible. Should probably be in a Scheduled Task set to run 'At log on' and 'Repeat task every: 1 hour'
$basePath = 'HKCU:\Control Panel\NotifyIconSettings\'
Get-ChildItem -Path $basePath | `
ForEach-Object { Get-ItemProperty "$basePath$($_.PSChildName)" } | `
Set-ItemProperty -Name 'IsPromoted' -Value 1
@psitem
psitem / Run-Trim.ps1
Last active November 1, 2023 17:37
None of my Windows 2022 Server instances will automatically TRIM my SSD volumes on a schedule, so I wrote this script to run as a scheduled task.
# Simplified version runs defrag command against all drive letters with only the TRIM flag. Original version
# did not run against my Storage Spaces RAID volumes since it couldn't convert a member Physical Disk to a
# drive letter but this version does. Drive letters that Windows doesn't recognize as SSD will be skipped.
$( Get-Volume | Where-Object { [string] $_.DriveLetter -ne '' } | ForEach-Object { "$($_.DriveLetter):" } ) -join ' ' | ForEach-Object {
& defrag $($_ -split ' ') /Retrim /MultiThread
}
@psitem
psitem / plex-monitor.ps1
Last active March 14, 2024 20:20
This is the Plex monitoring script that wrote and have been using since +/- 2017. I cribbed the list of processes to kill and the idea of checking that the web UI responded without error from other people's scripts but the rest is all me.
#Start-Transcript -Append -Path .\plex-monitor-transcript.log -IncludeInvocationHeader:$false -Force
<#
This is my Plex monitoring script. There are many like it, but this one is mine. If
you're running Plex as a Windows Service this script is not for you as-written, but
you could possibly modify it to work for you by commenting out the Start-Process
line, configuring the service to automatically restart, and coming up with a
different way to keep the script running.
This updated version should automatically discover the Plex installation path and
@psitem
psitem / Get-DisksWithEnclosureInfo.ps1
Last active October 9, 2023 16:43
Modifies the output of Get-PhysicalDisk to have enclosure information. Works On My Machine™ certified with an LSI SAS 9201-16e and Promise SAS enclosures.
<#
Wrote this to scratch an itch for tracking where my disks are physically located within and across
storage enclosures. Before writing this I was using a spreadsheet, which was tedious to maintain.
For this script to be useful, you'll need a storage enclosure that Windows recognizes and exposes
through WMI, ie: one that provides SCSI Enclosure Services (SES).
Check the output of Get-StorageEnclosure.
On my systems with multiple Promise J610S/J630S enclosures, Get-PhysicalDisk provides "Slot #" in
the PhysicalLocation property but the EnclosureNumber isn't populated. This script adds two
@psitem
psitem / archive.is.js
Last active May 19, 2024 08:28
This is my bookmarklet for archive.is. There are many like it, but this one is mine. This one strips the querystring and navigates directly to the latest archived version.
javascript:void(open('https://archive.is/newest/%27+encodeURIComponent( document.location.origin + document.location.pathname ),"_self"))
@psitem
psitem / gist:e874aa7636438deac881bf8a0175c0d8
Created November 10, 2018 20:37
memtester on EA CK G2+
root@ck-plus:~# memtester 2700M 10
memtester version 4.3.0 (64-bit)
Copyright (C) 2001-2012 Charles Cazabon.
Licensed under the GNU General Public License version 2 (only).
pagesize is 4096
pagesizemask is 0xfffffffffffff000
want 2700MB (2831155200 bytes)
got 2700MB (2831155200 bytes), trying mlock ...locked.
Loop 1/10:
@psitem
psitem / move-videos.cmd
Last active November 1, 2023 17:41
My naive Batch script for moving Television torrents
@ECHO OFF
GOTO :TheLoop
:TheFile
FOR /F "tokens=1-7 delims=. " %%a in (%1) do (
IF EXIST "\\server\tv\%%a %%b %%c %%d %%e %%f %%g" CALL :MoveFile %1 "\\server\tv\%%a %%b %%c %%d %%e %%f %%g\" & GOTO :EOF
IF EXIST "\\server\tv\%%a %%b %%c %%d %%e %%f" CALL :MoveFile %1 "\\server\tv\%%a %%b %%c %%d %%e %%f\" & GOTO :EOF
IF EXIST "\\server\tv\%%a %%b %%c %%d %%e" CALL :MoveFile %1 "\\server\tv\%%a %%b %%c %%d %%e\" & GOTO :EOF
IF EXIST "\\server\tv\%%a %%b %%c %%d" CALL :MoveFile %1 "\\server\tv\%%a %%b %%c %%d\" & GOTO :EOF
IF EXIST "\\server\tv\%%a %%b %%c" CALL :MoveFile %1 "\\server\tv\%%a %%b %%c\" & GOTO :EOF