This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
| File: Improved-Fill-TestLogVolume.sql | |
| Description: 🚀 Rapidly fills a SQL Server test database log file to simulate | |
| disk full and alerting scenarios. Useful for testing error | |
| handling, monitoring, and DBA/ops automation. 😎 | |
| Purpose: Quickly consume log file space to test SQL Server's response to | |
| log growth, disk full, and alerting. Designed for use in | |
| dev/test environments only! Not for prod! ⚠️ | |
| The script can optionally reserve a buffer of free space on the | |
| log drive, or attempt to fill the drive completely. See below. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Retrieves disk space info from remote computers and computes the | |
extra free space needed to meet target free space percentages. | |
.DESCRIPTION | |
This function serves as a wrapper around the dbatools.io Get-DbaDiskSpace cmdlet, | |
extending its functionality with additional calculations. | |
It queries remote systems for disk space details, filters the output by specified |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Edit-EBSVolumes { | |
<# | |
.SYNOPSIS | |
Modifies AWS EBS volumes with enhanced validation and confirmation 🔧🚀 | |
.DESCRIPTION | |
This function lets you change multiple AWS EBS volumes in one go! | |
It supports modifications to volume type, size, IOPS, and throughput | |
with safety confirmations and detailed feedback. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- ████████ FILE: monitor_active_sessions.sql ████████ | |
-- 🎯 MISSION OBJECTIVE: Real-time monitoring of active SQL Server sessions. | |
-- - If the table **does not exist**, create it. | |
-- - If the table **exists**, append new data. | |
-- - If you need a **hard reset**, uncomment the DROP TABLE line. | |
-- | |
-- 🔧 USAGE: | |
-- 🎮 Execute in SSMS or a SQL Agent job for continuous ops. | |
-- 🔬 Uncomment DROP TABLE if you want to refresh the dataset. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Retrieves AWS EC2 volume modification records and useful metadata. | |
🚀 Because sometimes we need speedy volume modifications! | |
.DESCRIPTION | |
The Get-EC2VolumeModificationDetails function retrieves modification details | |
for a list of specified EC2 volumes such as size, IOPS, volume type changes, | |
etc. It uses AWS SDK for .NET to interact with AWS EC2 services. | |
🤖 This function fetches the modification details and the associated instance |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Finds the recommended N-1 cumulative update for SQL Server based on patching strategy that avoids intermediate releases | |
.DESCRIPTION | |
This script queries a Google Sheets document containing SQL Server cumulative update information | |
and determines the recommended N-1 cumulative update based on a patching strategy that avoids | |
intermediate releases (e.g., hotfixes, security updates) between cumulative updates. | |
The script outputs the recommended cumulative update, its release date, and a link to more details. | |
The patching strategy is defined as follows: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
| File: ServiceBrokerLogNoiseReductionEndpoint.sql | |
| Description: 🚦 Creates a Service Broker endpoint to reduce SQL Server log noise. | |
| Purpose: Sets up a dedicated endpoint for Service Broker on a user-chosen | |
| port (default 4022), with checks for port conflicts and robust | |
| logging. Useful for DBAs who want to keep error logs clean and | |
| avoid noisy Service Broker errors. Includes optional code to drop | |
| the endpoint. For test/dev use or advanced troubleshooting. 😎 | |
| Created: 2024-05-21 | |
| Modified: 2025-05-22 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-ExplicitLogonEvents { | |
<# | |
.SYNOPSIS | |
Gets 4648 Explicit Logon Events from Windows Event Log | |
Author: Lee Christensen (@tifkin_) | |
# https://github.com/threatexpress/red-team-scripts/blob/3121db5d53a25d66afa01afb3bf0487d919d1846/HostEnum.ps1#L1552 | |
#> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#requires -version 5.0 | |
#Requires -RunAsAdministrator | |
<# DANGER REBOOTING! | |
This is meant for a local machine in a scheduled task | |
and is not handling remoting or remote credentials | |
#> | |
[CmdletBinding()] | |
param ( | |
[Parameter()][int]$DelayMinutes = 15 #default to 15 minute delay if this parameter is not supplied | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Store TimeSpan object in variable $timespan | |
$timespan = New-TimeSpan -Start (Get-Date) -End (Get-Date).AddHours(5) #(Get-Date).AddDays(1).Date.AddHours(5) #careful with this - syntax is weird | |
# Print a message to the console in magenta color indicating the time the script will resume execution | |
Write-Host -ForegroundColor magenta "Sleeping until $((Get-date).AddSeconds($timespan.TotalSeconds)) ..." | |
# Pause the execution of the script for a number of seconds equal to the total seconds of the $timespan | |
Start-Sleep -Seconds $timespan.TotalSeconds |
NewerOlder