Skip to content

Instantly share code, notes, and snippets.

View PSingletary's full-sized avatar
🔍
Search

PSingletary PSingletary

🔍
Search
View GitHub Profile
@PSingletary
PSingletary / profile.ps1
Created August 4, 2021 11:32 — forked from SteveL-MSFT/profile.ps1
PowerShell Prompt
#Requires -Version 7
# Version 1.2.10
# check if newer version
$gistUrl = "https://api.github.com/gists/a208d2bd924691bae7ec7904cab0bd8e"
$latestVersionFile = [System.IO.Path]::Combine("$HOME",'.latest_profile_version')
$versionRegEx = "# Version (?<version>\d+\.\d+\.\d+)"
if ([System.IO.File]::Exists($latestVersionFile)) {
@PSingletary
PSingletary / 12_Seasons.md
Created March 2, 2021 13:35
12 Seasons of Richmond

Richmond's 12 Seasons

  • Winter
  • Fool's Spring
  • Second Winter
  • Spring of Deception
  • Third Winter
  • The Pollening
  • Actual Spring
  • Summer
  • Hell's Front Porch
@PSingletary
PSingletary / Get-ADUserAudit.ps1
Created February 7, 2021 04:49 — forked from jdhitsolutions/Get-ADUserAudit.ps1
A PowerShell function and format file for getting Active Directory user management events from the security event logs on domain controllers.
#requires -version 5.1
#requires -module ActiveDirectory
#you might need to increase the size of the Security eventlog
# limit-eventlog -LogName security -ComputerName dom2,dom1 -MaximumSize 1024MB
Function Get-ADUserAudit {
[cmdletbinding()]
Param(
[Parameter(Position=0,HelpMessage = "Specify one or more domain controllers to query.")]
@PSingletary
PSingletary / gist:4b3380b2f76efda2e13dcbcefb653463
Created January 31, 2021 12:17 — forked from JT5D/gist:a2fdfefa80124a06f5a9
Google translate language codes
Eg. URL translating en page to es
http://translate.google.com/translate?hl=en&sl=en&tl=es&u=http://about.com
Define the web interface language to be English by adding
hl=en to the end of the URL and after the change the URL will look
like this:
http://www.google.com/search?hl=en
When you use more than one setting code in the URL, you need to use
@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}