Skip to content

Instantly share code, notes, and snippets.

@Gunslap
Gunslap / BINERDLE.ps1
Created April 12, 2022 20:15
A higher/lower number guessing game WORDLE knockoff in PowerShell... because why not?
<#
.Synopsis
BINERDLE - a binary response number guessing game!
.Description
Try to guess the number using only "HIGHER" and "LOWER" as clues before your guesses run out!
.Parameter numGuesses
The number of guesses to give the player. Default 10.
@Gunslap
Gunslap / Files2Folders.ps1
Created February 2, 2022 17:24
Move All Files in a Folder to Subfolders (Handy for Radarr Movies)
$path = "V:\_Movies" #Path to scan
#Grab all files + folders in that path
$childItems = Get-ChildItem -Path $path -Force
#Loop through the child items
foreach($item in $childItems)
{
#filter out directories
if($item.PSIsContainer -eq $false)
@Gunslap
Gunslap / GooglePhotosTakeoutRenamer.ps1
Created December 2, 2020 04:30
Rename Photos Downloaded from Google Photos Using Takeout
#Google Photos File Renamer:
#just a quick script to rename your jpg's downloaded from google photos after their subfolder's name
#(the date they were uploaded if you used Google Takeout) while adding an incrementing number
#ie: "(1)" like explorer does if the filename already exists
#Path to Google Photos directory (should have subdirectories named as dates)
$path = Get-ChildItem -Path "D:\Downloads\Takeout\Google Photos"
#Loop through the subfolders
foreach ($folder in $path) {
@Gunslap
Gunslap / EmailExpiringPasswordReminder.ps1
Last active May 9, 2017 19:21
This script will query AD for user's whose passwords will expire on the day, 5 days from today, and 1 day, and then send them an email reminder, as well as writes the emailed users out to a log.
<#
**************************************
* Email Expiring Password Reminder *
**************************************
Created By: Gunslap
Purpose:
This script will query AD for user's whose passwords will expire on the day, 5 days from today, and 1 day, and then send them an email reminder, as well as writes
the emailed users out to a log.
@Gunslap
Gunslap / Set-DesktopBackgroundtoDefault.ps1
Last active December 6, 2022 20:40
This script will loop through all of the user profiles on the local machine and reset the desktop background to the default value in the registry (user hive). Win7 to Win10 USMT doesn't copy over custom wallpapers. So this is often left blank, leaving users with a black background. This is also a good example of how to edit user hive files throu…
<#
*************************************************************
* Set Desktoop Background to Default for All Local Profiles *
*************************************************************
Purpose:
This script will loop through all of the user profiles on the
local machine and reset the desktop background to the default value in the registry (user hive).
Win7 to Win10 USMT doesn't copy over custom wallpapers.
So this is often left blank, leaving users with a black background.
@Gunslap
Gunslap / ModifyUserLyncNumber.ps1
Created May 9, 2017 18:05
This script will allow you to automate Lync (Skype for Business) number assignment. It will update the user's number in Lync, as well as AD.
#############################
# Modify User Lync Number #
#############################
<#
Description:
This script will allow you to automate Lync (Skype for Business) number assignment.
It will update the user's number in Lync, as well as AD.
If you use a spreadsheet to track number assignment you'll want to add sections to update that as well.
Prereqs:
@Gunslap
Gunslap / MultiWOL.ps1
Created June 20, 2014 20:50
Script to take in list of computers (Name, IP, MAC Addresses) either from CSV or object array passed in and send a Wake On LAN command to each computer
<#
********************************
* Multi Wake On LAN Script *
********************************
By: Gunslap
Last Updated: June 20th/2014
Purpose:
This script will loop through a provided .csv list of MAC addresses, or a list passed in from
@Gunslap
Gunslap / AccountDisablerFunction.ps1
Last active June 29, 2020 04:05
Scans Active Directory for inactive accounts and disables and relocates them accordingly.
<#
.SYNOPSIS
This function disables accounts that are older than a certain threshhold.
.DESCRIPTION
Searches active directory for users based on an inputted searchbase for users that haven't logged in since a certain threshhold or haven't logged in ever and were created before that threshhold and disables them and marks in their description when and why they were disabled.
.PARAMETER $SearchBase
This is where to search in Active Directory. Must be in DN form: "ou=x,ou=x,dc=x,dc=x".
@Gunslap
Gunslap / ADChangeLogger.ps1
Last active February 10, 2017 23:35
Creates a log of changes made to users in AD and emails it out (formatted in HTML) nightly.
#NOTE: MUST be ran as administrator!
<#
*****************************************************
* ADChangesLogger *
*****************************************************
Created By: Gunslap
Date Created: June 2nd, 2014
@Gunslap
Gunslap / ADAccount-Create.ps1
Last active September 15, 2016 19:17
Active Directory Account Creator - Takes in a .CSV list of full names (ie: "John Smith") and using company policy criteria, bulk creates user accounts.
<#
*****************************************************
* Active Directory Account Creator *
*****************************************************
#>
function GetHelp() {
$HelpText = @"
DESCRIPTION: