improvement(non-interactive): param-or-env input across all scripts; drop RMM variable + prompts#105
Open
Gumbees wants to merge 6 commits into
Open
improvement(non-interactive): param-or-env input across all scripts; drop RMM variable + prompts#105Gumbees wants to merge 6 commits into
Gumbees wants to merge 6 commits into
Conversation
…serInteractive The $env:RMM / $RMM flag added noise and was a recurring source of hangs when it wasn't set/seen. Remove it from today's scripts and the standard; decide interactive vs unattended solely via [Environment]::UserInteractive. Scripts (checkpoint-aging, delete-all-checkpoints, suspend-bitlocker, enable/disable-core-isolation): - Gate prompts on `if ([Environment]::UserInteractive)`. - Drop the `## $env:RMM` doc line and the `Write-Host "RMM:"` line. - $env:Description / $env:DaysAging / $env:RMMScriptPath unchanged. Standard: - CLAUDE.md: execution mode is decided by UserInteractive, not an RMM variable. - script-template-powershell.ps1: template gate + header updated to match. Supersedes #100 and #104. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit at claude.ai/admin-settings/claude-code.
Once credits are available, push a new commit or reopen this pull request to trigger a review.
This was referenced Jun 24, 2026
Every input is now supplied only as a -Parameter or an $env: variable of the same name (each param defaults to its $env: counterpart). No Read-Host, no $env:RMM flag, no [Environment]::UserInteractive: scripts are non-interactive by design and never block waiting for input. Rewrites script-template-powershell.ps1 to the new pattern and updates CLAUDE.md (input-handling standard, NinjaRMM output gating via Get-Command, cross-context OrgName, Testing section) and the now-current Git Workflow section (main is the single trunk; development retired). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Applies the script-template-powershell.ps1 standard across the library: each script gains a param() block (one [string] per input, defaulting to its $env: counterpart) and the if($RMM)/if([Environment]::UserInteractive) + Read-Host input blocks are removed. Original defaults, required-input validation (now fail-fast, no prompt fallback), log-path logic, and all automation are preserved. NinjaRMM output writes are re-gated on Get-Command Ninja-Property-Set instead of an $env:RMM flag. 103 scripts converted. Verified: every changed script parses cleanly as UTF-8 and no Read-Host / $env:RMM / $RMM / UserInteractive remains as code. Note: ~15 scripts also pick up a CRLF->LF normalization that the repo's .gitattributes (* text=auto) already mandated; their blobs predated it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…g noise - OrganizationKey now defaults to $env:NINJA_ORGANIZATION_NAME and TagsKey to $env:NINJA_LOCATION_NAME (Ninja's built-in org/location variables). AccountKey still passes through from its $env: Ninja variable (unchanged). - Remove the dead $acctkey/$orgkey/$tags command-line override blocks: nothing set those under RMM usage and, with Set-StrictMode enabled, they only emitted "variable cannot be retrieved" errors into the output log on every run. - Declare the install-mode switches ($reregister/$reinstall/$uninstall/$repair) at script scope (default off = normal fresh install) for the same reason. Behavior preserved (verified): script parses clean and an unattended run now emits zero StrictMode undefined-variable errors instead of 4+. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Lightweight RMM condition script (modeled on msft-windows-s2d-health-check): detects recent bluescreens and exits 1 so an RMM monitor can alert; exits 0 when clean. Unlike msft-windows-bsod-diagnostics, it needs no API key and does no AI analysis -- it just answers "did this machine bluescreen recently?". Detection within a configurable window ($LookbackDays / $env:LookbackDays, default 1): - Bug Check events (Microsoft-Windows-WER-SystemErrorReporting, Event ID 1001) -- the authoritative "rebooted from a bugcheck" signal, with stop code + dump path - Minidump files in %SystemRoot%\Minidump written within the window Written to the non-interactive param-or-env standard. Verified: parses clean and runs (exit 0 / no false positives) on a machine with no crash history. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ntion) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
7 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Establishes and rolls out a single input standard across the whole script library:
This supersedes the earlier "gate on
UserInteractive" approach in the first commit of this PR.Changes
script-template-powershell.ps1rewritten to the param-or-env pattern.CLAUDE.mdupdated: input-handling standard, NinjaRMM output writes re-gated onGet-Command Ninja-Property-Set(not an RMM flag), cross-contextOrgName, Testing section, and the Git Workflow section (now:mainis the single trunk;developmentretired).param()block (one[string]per input, defaulting to$env:<Name>); theif ($RMM)/if (UserInteractive)+Read-Hostblocks are removed. Original defaults, required-input validation (now fail-fast, no prompt fallback), log-path logic, and all automation are preserved.Verification
Read-Host/$env:RMM/$RMM/UserInteractiveremains as code.Notes
.gitattributes (* text=auto)already mandated (their blobs predated the policy), so those diffs look whole-file though the real change is only the input handling.main.