Files
rb/scripts/_template.ps1
igodwin f2a979f047 Add MIT LICENSE and a per-file as-is notice
The repo is public and files are fetched by raw URL, so a reader who lands
on one runbook never sees the README -- the repo's context does not travel
with the file. Each .md now carries two lines under the title, each .ps1 the
equivalent at the end of its .NOTES block.

Deliberately two lines, not a paragraph. These files are read through `| more`
on a client console mid-incident, and the top of the file is where the
procedure-specific warnings live -- never a live chart, stop the service
before copying, confirm authorization before acting. A legal preamble above
those competes with them and trains people to skip past.

Wording aims at a stranger who found the repo, not at the quality of the
procedure: these double as documented-procedure evidence for E&O, and
language implying the content is unreliable works against that.

MIT rather than no license: the warranty and liability disclaimer is the part
that does the work, and leaving it unlicensed makes reuse ambiguous rather
than disclaimed.

Also fixes 5 stale ops/rb URLs in scripts/*.ps1 that the previous commit
missed -- it only swept the .md files.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HwcG1jLs1T425QRMxtjxP7
2026-09-02 23:06:44 -07:00

65 lines
2.2 KiB
PowerShell

<#
.SYNOPSIS
One-line description of what this runbook script does.
.DESCRIPTION
Longer context: symptom it addresses, what it changes, whether it reboots.
.NOTES
Convention for scripts in this repo — designed to run via:
irm rb.godwinsystems.com/scripts/<file>.ps1 | iex
Because `irm | iex` runs in the caller's session:
- No param() block — you can't pass args through the pipe. Prompt with
Read-Host instead.
- #Requires is NOT enforced under iex — check for admin manually below.
- Keep it self-contained: no external module installs, no dot-sourcing.
PUBLIC REPO: placeholders only. Never hard-code a client, host, user, or
secret. Prompt for them at run time.
Provided as-is, without warranty. This runs in your session via `iex` —
read it before you run it. You are responsible for the systems you run
it on. See LICENSE.
#>
$ErrorActionPreference = 'Stop'
# --- Admin check (do not rely on #Requires under iex) ---
$isAdmin = ([Security.Principal.WindowsPrincipal] `
[Security.Principal.WindowsIdentity]::GetCurrent()
).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
if (-not $isAdmin) {
Write-Warning 'This script needs an elevated PowerShell session. Re-run as Administrator.'
return
}
Write-Host '== <SCRIPT TITLE> ==' -ForegroundColor Cyan
# --- Prompt for placeholders (no param block; iex-safe) ---
$server = Read-Host 'Server hostname <SERVER>'
$shareUser = Read-Host 'Share account <SHARE_USER>'
# For secrets, use -AsSecureString and never echo or persist them:
# $secure = Read-Host 'Password <PASSWORD>' -AsSecureString
# --- Confirm before destructive / disruptive actions ---
Write-Host ''
Write-Host "About to: <describe the change> on $server" -ForegroundColor Yellow
if ((Read-Host 'Proceed? (y/N)') -ne 'y') {
Write-Host 'Aborted. No changes made.'
return
}
# --- Do the work ---
try {
# ... the actual commands ...
Write-Host 'Done.' -ForegroundColor Green
}
catch {
Write-Warning "Failed: $($_.Exception.Message)"
return
}
# --- If a reboot is required, confirm separately ---
# if ((Read-Host 'Reboot now to apply? (y/N)') -eq 'y') { shutdown /r /t 0 }