Files
rb/scripts/od-cfg-acl.ps1
T
igodwin cb0c5b4614 Move runbooks into domain directories
od-db-backup.md becomes od/db-backup.md -- the hyphen becomes a slash, so
the fetch command is exactly as long to type as before. That mattered: the
length of a hand-typed command is the constraint this repo is organized
around, and a reorganization that lengthened it would have been a net loss.

Scripts deliberately stay flat in scripts/ with their domain prefix.
Everything executable in one directory is the set worth reading before it
runs, and nesting five files by domain would add characters without adding
clarity.

Updates every reference: README Contents (now grouped by directory), the
layout section, both fetch examples, inter-runbook links, and the .NOTES
headers in all five scripts. Verified every markdown link resolves on disk
and that Contents and the filesystem agree in both directions.

Records the naming rule in CONTRIBUTING so the next file lands correctly.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HwcG1jLs1T425QRMxtjxP7
2026-09-02 23:15:48 -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