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
-- database_role_securables_query.sql | |
-- modeled after SSMS Securables page of Database Roles properties | |
DECLARE @RoleName NVARCHAR(128); | |
SET @RoleName = ''; -- Replace with role name or leave empty for testing | |
IF @RoleName = '' | |
BEGIN | |
SELECT 'Please provide a valid role name to query securables' AS Message; |
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
<# Table Export #> | |
$someTables = @" | |
TBL_A_FOO | |
TBL_B_BAR | |
TBL_C_BAZ | |
TBL_D_QUX | |
TBL_E_QUUX | |
TBL_F_CORGE | |
"@.split("`n").TrimEnd("`r") |
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
$files = Get-ChildItem -Path "A:\Phoenix" | |
# Define the comment start and end markers | |
$commentStart = '/*' | |
$commentEnd = '*/' | |
foreach ($file in $files) { | |
# Open the file and read the first 1024 bytes | |
$maxBytes = 1024 | |
$buffer = New-Object byte[] $maxBytes |
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
# 2023-06-29 version originally by nanoDBA, greatly enhanced by OpenAI's ChatGPT model | |
<# | |
.SYNOPSIS | |
Get the volumes attached to the EC2 instances. | |
.DESCRIPTION | |
This function retrieves the volumes attached to the specified EC2 instances in the specified region. | |
It returns a list of volume details including the instance ID, instance name, instance type, volume ID, device name, state, availability zone, volume type, IOPS, throughput, and size. | |
.PARAMETER InstanceNames |
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
# filename: Lock_and_power_off_display.ps1 | |
# | |
# This script turns off the display and locks the workstation using the Windows API. | |
# | |
# Warning: This script will turn off the display and lock the workstation indefinitely until stopped manually. | |
# | |
# Import the necessary libraries for interacting with the Windows API | |
Add-Type @" | |
using System; | |
using System.Runtime.InteropServices; |
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
# create an array of SQL Server instances | |
$allInstances = @('server1', 'server2', 'server3') | |
# Loop through each SQL server instance | |
foreach($sqlInstance in $allInstances) { | |
# Output the current SQL server instance | |
Write-Output "`$sqlInstance: $sqlInstance" | |
# Execute a query on the current SQL server instance and store the results |
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
# Console Output RED/GREEN failures for SQL Agent job history, multiple key property sorts | |
# attempting to imitate the output of the SQL Server Management Studio Job History window | |
$paramHash = @{ | |
SqlInstance = 'YOURSERVER01','YOURSERVER02' # comma separated list of SQL Server instances | |
StartDate = "$(((Get-Date).AddDays(-.1) ))" # 0.1 days ago - ARE YOU SURE? This does not mean 1 day. It means 2.4 hours ago. | |
# StartDate = "$(((Get-Date).AddDays(-90) ))" # 90 days ago | |
EndDate = "$((Get-Date ))" # now | |
Job = 'Some SQL Agent Job Name goes here' # name of SQL Agent job goes here | |
ExcludeJobSteps = $false |
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
Proposed SQL Server Patching Approach | |
We do not patch to the absolute latest cumulative update(CU). | |
Rather, we strive to patch to the cumulative update(CU) that | |
was released without any intermediate releases(such as hotfixes) | |
between it and the most recent CU. Basically N-1 as long as | |
there aren't any hotfixes. If there were hotfixes then we'll wait | |
until two CU subsequent releases have occurred | |
without hotfixes in between the two to deploy the CU. |
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
$filename = "A:\Users\kilroy\Remove_lack_of_motion.mp4" | |
# Use ffprobe to extract the avg_frame_rate | |
$fpsFraction = ffprobe -v error -select_streams v:0 -show_entries stream=avg_frame_rate -of default=noprint_wrappers=1:nokey=1 "$filename" | |
$fps = Invoke-Expression "($fpsFraction)" | |
# Convert fractional fps to a numeric value if necessary | |
if ($fpsFraction -match "/") { | |
$fpsParts = $fpsFraction -split "/" | |
$fps = [double]$fpsParts[0] / [double]$fpsParts[1] |
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 | |
BoxStarter script to configure Windows 10 development PC. | |
.DESCRIPTION | |
You might need to set: | |
Set-ExecutionPolicy RemoteSigned | |
Set-ExecutionPolicy Unrestricted | |
Set-ExecutionPolicy Bypass |