Skip to content

Instantly share code, notes, and snippets.

Avatar

Bill Long bill-long

View GitHub Profile
@bill-long
bill-long / jwt.html
Created May 13, 2021
Super simple JWT parser that can be run locally. No need for a web server.
View jwt.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Bilong JWT</title>
<base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
textarea {
View Find-Sid.ps1
<#
.SYNOPSIS
Searches the forest for a SID match in objectSid, sidHistory, or msExchMasterAccountSid.
.EXAMPLE
PS C:\> .\Find-Sid.ps1 -Sid "S-1-5-21-408950988-2208783158-1246939005-2158"
Shows all objects matching the specified SID.
#>
[CmdletBinding()]
param (
[Parameter(Mandatory = $true, ValueFromPipeline = $true)]
View Lab-E15E16E19.ps1
$prefix = "LAB1"
New-LabDefinition -Name E15E16E19 -DefaultVirtualizationEngine HyperV -ReferenceDiskSizeInGB 100 -VMPath "E:\VMs"
$e15role = Get-LabPostInstallationActivity -CustomRole Exchange2013 -Properties @{ OrganizationName = 'First Organization' }
$e16role = Get-LabPostInstallationActivity -CustomRole Exchange2016 -Properties @{ OrganizationName = 'First Organization' }
$e19role = Get-LabPostInstallationActivity -CustomRole Exchange2019 -Properties @{ OrganizationName = 'First Organization' }
Add-LabMachineDefinition -Name "$($prefix)DC1" -OperatingSystem 'Windows Server 2016 Standard (Desktop Experience)' -MinMemory 2GB -Memory 2GB -MaxMemory 8GB -Processors 4 -DomainName "$($prefix.ToLower()).local" -Roles RootDC
View Find-PartialEntryId.ps1
<#
.SYNOPSIS
Finds a mailbox item using a partial EntryId and a message class.
.DESCRIPTION
Corrupted items may have only a few properties and an EntryId that
cannot be opened in MFCMapi. This often surfaces as a reminder that
repeatedly shows up while the appointment for that reminder cannot
be found.
When other approaches fail, you can find the corrupted
View Dump-ScanningProcessOnTimeout.ps1
# Dump-ScanningProcessOnTimeout
###################################
#
# Change these paths as needed.
#
$dumpFolder = 'C:\data'
$procdumpBinary = 'C:\ProgramData\chocolatey\lib\sysinternals\tools\procdump.exe'
View Attach-OnProcessStart.ps1
# Attach-OnProcessStart
$ProcessName = "notepad.exe"
$ExceptionFilter = "ScanQueueTimeoutException"
Register-CimIndicationEvent -ClassName Win32_ProcessStartTrace -SourceIdentifier "ProcessStarted"
while ($true) {
$e = @(Get-Event)
if ($e.Count -lt 1) {
View Watch-PhysicalIndexes.ps1
param($Database, $MailboxNumberToWatch)
$startingNumber = 0
$currentNumber = 0
$results = .\Count-PhysicalIndexes.ps1 -Database $Database -SaveResults $true
$startingNumber = ($results | Where-Object { $_.MailboxNumber -eq $MailboxNumberToWatch }).IndexCount
$currentNumber = $startingNumber
View Count-PhysicalIndexes.ps1
param($Database, $SaveResults)
. $exscripts\ManagedStoreDiagnosticFunctions.ps1
if ($null -eq (Get-Command Get-StoreQuery -ErrorAction SilentlyContinue)) {
Write-Error "ManagedStoreDiagnosticFunctions not loaded."
return
}
$results = @()
View Analyze-PhysicalIndexes2013.ps1
# Reports the number of indexes per folder for a given mailbox.
# Mailbox can be specified by display name or mailbox number.
[CmdletBinding()]
param (
[Parameter(Position = 0, Mandatory = $true)]
[string]
$Database,
[Parameter()]
View Analyze-PhysicalIndexes.ps1
# Reports the number of indexes per folder for a given mailbox.
# Mailbox can be specified by display name or mailbox number.
[CmdletBinding()]
param (
[Parameter(Position=0, Mandatory=$true)]
[string]
$Database,
[Parameter()]