added context for agents

This commit is contained in:
2026-07-16 10:42:41 -04:00
parent 8a53de4430
commit 912bff8d81
+21
View File
@@ -0,0 +1,21 @@
# Repository Guidance
## RMM script execution model
Scripts in this repository are generally executed by a small caller script in the RMM. The caller first downloads and dot-sources `Tools.ps1` from the public repository URL:
```powershell
. $([Scriptblock]::Create((New-Object Net.WebClient).DownloadString('https://dev.emberkom.com/emberkom/management-scripts/raw/branch/master/Tools.ps1')))
```
The caller then invokes `Run-Script`, passing the repository script's filename without the `.ps1` extension:
```powershell
Run-Script -LivePSScript Create-BatteryReport
```
For a live PowerShell script without `-Arguments`, `Run-Script` downloads the target script and dot-sources it. This keeps the core script logic in version control, and changes pushed to the repository take effect in production without updating each RMM caller.
When a repository script needs RMM-provided input, define the variable in the RMM caller before calling `Run-Script`. Because the target is dot-sourced into the caller's scope, it can read that variable directly.
When changing `Run-Script` or scripts invoked through it, preserve this shared-scope behavior unless the change explicitly includes migrating all affected RMM callers.