Files
rb/scripts/od-cfg-acl.ps1
T
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

69 lines
3.0 KiB
PowerShell

<#
.SYNOPSIS
Grant the built-in Users group Modify on Open Dental's FreeDentalConfig.xml
so the "Do not show this window on startup" setting persists for standard
users.
.DESCRIPTION
Open Dental stores the Choose Database window's "do not show on startup"
setting in FreeDentalConfig.xml in the install directory. Standard (non-admin)
users lack write permission there, so the checkbox never saves and the window
returns on every launch. This grants the built-in Users group Modify on that
one file, using the well-known SID (locale-independent).
Auto-resolves the install directory across 64-bit / 32-bit Program Files;
fails clearly if FreeDentalConfig.xml isn't found in either.
.NOTES
Run via: irm rb.godwinsystems.com/scripts/od-cfg-acl.ps1 | iex
Referenced by od-cfg-persist.md, Option B.
SECURITY: on direct-connection setups FreeDentalConfig.xml also holds the
MySQL password (obfuscated but reversible). Widening write access here does
not change that exposure, but prefer a limited MySQL user over root for
workstation connections, and Middle Tier as the long-term fix that removes
per-workstation DB credentials entirely. See the runbook's security note.
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 '== Open Dental: make FreeDentalConfig.xml writable by Users ==' -ForegroundColor Cyan
# --- Resolve install path across 64-bit / 32-bit Program Files ---
$bases = @(${env:ProgramFiles(x86)}, $env:ProgramFiles) | Where-Object { $_ }
$candidates = $bases | ForEach-Object { Join-Path $_ 'Open Dental\FreeDentalConfig.xml' }
$configPath = $candidates | Where-Object { Test-Path $_ } | Select-Object -First 1
if (-not $configPath) {
Write-Warning "FreeDentalConfig.xml not found. Checked:`n $($candidates -join "`n ")"
Write-Warning 'If Open Dental is installed elsewhere, grant Users Modify on that copy manually.'
return
}
Write-Host "Found: $configPath" -ForegroundColor Green
Write-Host 'About to grant the built-in Users group (S-1-5-32-545) Modify on this file.' -ForegroundColor Yellow
if ((Read-Host 'Proceed? (y/N)') -ne 'y') {
Write-Host 'Aborted. No changes made.'
return
}
# --- Grant Modify to Users via well-known SID (not the localized name "Users") ---
icacls "$configPath" /grant '*S-1-5-32-545:M'
if ($LASTEXITCODE -ne 0) {
Write-Warning "icacls returned exit code $LASTEXITCODE — permission not changed."
return
}
Write-Host 'Done. Relaunch Open Dental as the standard user to confirm the window is gone.' -ForegroundColor Green