Skip to content

Instantly share code, notes, and snippets.

View PSingletary's full-sized avatar
🔍
Search

PSingletary PSingletary

🔍
Search
View GitHub Profile
@PSingletary
PSingletary / UltimateListIds.md
Created January 10, 2021 18:15 — forked from LanceMcCarthy/UltimateListIds.md
List of Package Ids
Name Package Id Version Source
7Zip 7zip.7zip 19.0.0 winget
Alttab Salamander salamander choco
Alt-Tab Terminator alt-tab-terminator choco
AutoHotkey Lexikos.AutoHotkey 1.1.33.02 winget
AutoHotkey Store Edition HaukeGtze.AutoHotkeypoweredbyweatherlights.com Latest msstore (via winget)
Carnac
@PSingletary
PSingletary / .stop-userprocesses.md
Last active February 10, 2021 11:02
What's running? Nevermind, I don't care. KILL ALL USER PROCESSES!!!!!

Sometimes you feel like you need a reboot, but don't want to lose minutes shutting down and starting back up. Both of these files do the same thing.

  • Finds all the things running the the context of the current accunt logged/running
  • Stops them

Need this? Here's how to setup

  1. Level 1 comfort - umm this is scary
    1. Click the Download .zip button in upper right
    2. Open Downloads folder
  2. Unzip to desktop
@PSingletary
PSingletary / Get-Boots.ps1
Created December 15, 2020 02:04
Last boottime examples
#Requires -Version 5.1
#Requires -PSEdition Desktop
Get-CimInstance -ClassName win32_operatingsystem | select csname, lastbootuptime
get-eventlog system | where-object {$_.eventid -eq 6006} | select -first 10
@PSingletary
PSingletary / ScanMedia.md
Created December 6, 2020 22:39 — forked from Desani/ScanMedia.md
3.2 - bugfix and New Major Update 3.0 - Massive re-write and new feature introduction with new User Menu Interface

This script utilizes ffmpeg, the same tool Plex uses, to decode the video stream and captures the output for any errors during playback and sends the playback errors to a log file. So essentially it plays the video in the background faster than regular speed. It then checks the error output log file to see if there is anything inside. If ffmpeg was able to cleanly play the file, it counts as a passed file. If there is any error output, an error could be anything from a container issue, a missed frame issue, media corruption or more, it counts the file as failed. So if there would be an issue with playback and a video freezing, it would be caught by this method of checking for errors. Because of the nature of the error log, any errors that show up, even simple ones, will all count as a fail and the output is captured so you can view the error log. Some simple errors are easy to fix so I have included an auto-repair feature which attempts to re-encode the file which is able to correct some issues that would cau

@PSingletary
PSingletary / Get-Password_Expiration.ps1
Created June 4, 2020 17:27
Get the password expiration date of a samAccountName (AD User object)
<#
.SYNOPSIS
Gets samaccountname password expiration date
.DESCRIPTION
Quickly determine the password expiration date of an Ad User account:
Good - got some time before password expires
Changes soon - password needs to be changed in 11 days
Expired
.EXAMPLE
PS C:\> Get-Password_Expiration.ps1
#Define RegEx filter to match folder names
$FoldersToRemove = “(cache|storage|database|blob|IndexedDB|tmp)”
#Get folders within Teams AppData area
$Folders = Get-ChildItem “C:\Users\$($_.Name)\AppData\Roaming\Microsoft\Teams”
#Switch statement checks the folder names and removes if found to match what is in $FoldersToRemove
switch -RegEx ($Folders.Name) {
$FoldersToRemove {Remove-Item $_.FullName -Recurse -Force}
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
$formHome = New-Object system.Windows.Forms.Form
$formHome.ClientSize = '650,300'
$formHome.text = "STL Printers"
$formHome.TopMost = $false
$items = New-Object system.Windows.Forms.ListBox
$items.text = "listBox"
$1DrivePath = "C:\users\XXXXXXXXXX\OneDrive\windowsterminal\settings.json"
$params = @{
Path = "$ENV:Userprofile\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json"
ItemType = "HardLink"
Value = $1DrivePath
}
Move-Item -Path $params.path -Destination $params.value
New-Item @params
[CmdletBinding(SupportsShouldProcess)]
Param(
#how many backup copies should be saved
[int]$Limit = 7,
#backup folder
[parameter(HelpMessage = "Specify the backup location")]
[ValidateScript({Test-Path $_})]
[string]$Destination = "C:\users\jeff\OneDrive\windowsTerminal"
)
function Get-FileDimensionAndPath
{
Param([string]$folder)
$shell = New-Object -ComObject Shell.Application
$shellFolder = $shell.namespace($folder)
foreach ($file in $shellFolder.items())
{
$hash =@{