Skip to content

Instantly share code, notes, and snippets.

Automating things.......from home!

Luke Leigh BanterBoy

Automating things.......from home!
View GitHub Profile
BanterBoy / Find-FilesLastDays.ps1
Created Jun 29, 2018
Short scrappy script to locate recently created files (scripts/notes)
View Find-FilesLastDays.ps1
$DaysPast = Read-Host "Enter Number of Days"
$Start = (Get-Date).AddDays(-$DaysPast)
$Path = Read-Host "Enter Search Path"
$Extenstion = Read-Host "Enter Extenstion"
$Stopwatch = [system.diagnostics.stopwatch]::startNew()
Get-ChildItem -Path $Path -Include $Extenstion -Recurse |
Where-Object { $_.LastWriteTime -ge "$Start" } |
BanterBoy / Capture-MainWindowTitle.ps1
Last active Jul 25, 2018
Snippet used to capture the title bar for all active windows for all foreground processes
View Capture-MainWindowTitle.ps1
$p = @(Get-Process -Name *)
$p | Select-Object -Property MainWindowTitle | Where-Object { $_.MainWindowTitle -match "\w+" }
View Find-Domainadmins.ps1
Get-ADGroupMember -Identity Administrators -Recursive |
ForEach-Object { get-aduser $_} |
Select-Object SamAccountName, GivenName, Surname, objectclass, name, enabled |
Sort-Object SamAccountName |
Format-Table -AutoSize
BanterBoy / Check-HIPBPwned.ps1
Created Jun 2, 2018
Quick script to check an Email address against also creates object $Pwned which can then be interrogated further.
View Check-HIPBPwned.ps1
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$PwnedSite = ""
$PwnedAddress = Read-Host "Email Address"
Invoke-RestMethod -Uri ($PwnedSite + $PwnedAddress) -OutVariable Pwned
BanterBoy / IP-Scan.ps1
Last active Aug 6, 2018
Resolve PTR for an array of IP's
View IP-Scan.ps1
$IPs = New-Object System.Collections.ArrayList

Keybase proof

I hereby claim:

  • I am banterboy on github.
  • I am lukeleigh ( on keybase.
  • I have a public key ASDtkLpfa19ylVA7cUgFDXSqwo7cScFxbEWP786RCZsIvAo

To claim this, I am signing this object:

BanterBoy / Get-PatchTue.ps1
Created Jun 10, 2020
PowerShell function to show you when the next patch Tuesday will occur. You can also specify month/year to find historical or future dates.
View Get-PatchTue.ps1
function Get-PatchTue {
Get the Patch Tuesday of a month
The month to check
The year to check
Get-PatchTue -month 6 -year 2015
BanterBoy / Get-LatestFiles.ps1
Created Aug 10, 2020
Powershell cmdlet for locating recent files in a specified folder.
View Get-LatestFiles.ps1
Short function to find recently saved files.
Short function that can be used to find/locate recently saved files.
Searches are performed by passing the parameters to Get-Childitem which will then
recursively search through your specified file path and then perform a sort to output
BanterBoy / Test-IsAdmin.ps1
Created Aug 14, 2020
Function to test if the current session is running as an administrator
View Test-IsAdmin.ps1
function Test-IsAdmin {
Tests if the user is an administrator
Returns true if a user is an administrator, false if the user is not an administrator
$identity = [Security.Principal.WindowsIdentity]::GetCurrent()
BanterBoy / New-AdminShell.ps1
Created Aug 14, 2020
Function used in conjunction with Test-IsAdmin to start a new Admin Shell (runs powershell or pwsh as admin)
View New-AdminShell.ps1
function New-AdminShell {
Starts an Elevated PowerShell Console.
Opens a new PowerShell Console Elevated as Administrator. If the user is already running an elevated
administrator shell, a message is displayed in the console session.