PowerShell7 is an LM Studio plugin that lets local models run real PowerShell 7 commands and managed .ps1 scripts through pwsh, with practical safety controls such as timeouts, output limits, risk checks, confirmation gates, and audit logging.
PowerShell7 uses real PowerShell 7 through pwsh.exe on Windows or pwsh on other platforms. It does not use Windows PowerShell 5.1, and it intentionally rejects powershell.exe because that executable is not PowerShell 7.
The plugin supports two execution modes:
pwsh..ps1 scripts created, executed, and deleted inside the configured scripts directory.This plugin gives local models command execution ability. It is not an OS sandbox. Commands and scripts run with the current user's permissions and can read, write, modify, or delete anything that user account can access.
Review commands and scripts before allowing high-risk execution. Do not use this plugin with untrusted models, untrusted prompts, or workflows where command execution should not be available.
diagnose_powershell7Diagnoses PowerShell path resolution, version, edition, working directory, and active configuration.
get_powershell7_configReturns the current plugin configuration as seen by LM Studio without running PowerShell.
run_powershell7Runs an inline PowerShell 7 command.
create_ps1_fileCreates or overwrites a managed .ps1 file inside the configured scripts directory.
run_ps1_fileRuns a managed .ps1 file from the configured scripts directory.
delete_ps1_fileDeletes a managed .ps1 file from the configured scripts directory.
Configuration is done through LM Studio's plugin settings UI. Environment variables are available only as an advanced fallback for local development or non-standard runtime setups.
| Field | Description |
|---|---|
| PowerShell 7 Path Mode | Selects automatic or manual PowerShell 7 path resolution. Automatic mode is the default. |
| Manual PowerShell 7 Path | Used only in manual mode. Example: C:\Program Files\PowerShell\7\pwsh.exe. |
| Default Timeout Seconds | Default timeout for inline commands and managed scripts. |
| Maximum Timeout Seconds | Upper bound for requested command or script timeouts. |
| Stdout Max Bytes | Maximum stdout bytes returned to the model. |
| Stderr Max Bytes | Maximum stderr bytes returned to the model. |
| Scripts Directory | Directory where managed .ps1 files are stored. |
| Audit Log Path | JSONL audit log path. |
| Strip ANSI Output | Removes ANSI escape sequences from returned output. |
| Use Normal PowerShell Error View | Uses PowerShell's normal error view for cleaner error output. |
Automatic mode searches for pwsh.exe or pwsh. Manual mode lets the user specify an explicit PowerShell 7 path, such as:
The manual path must point to pwsh.exe or pwsh. powershell.exe is intentionally rejected.
LM Studio's plugin settings UI is the main configuration method. These environment variables are intended only as an advanced fallback:
or:
Inline command:
List files:
Create a script:
Run a script:
Delete a script:
The risk scanner assigns commands and scripts to practical risk levels:
low: normal read/output commands.medium: file writes, downloads, installs, process actions, and non-recursive deletion.high: system policy, service, user, or security-sensitive changes that require confirmation.blocked: catastrophic or clearly dangerous commands.Blocked examples include:
Clear-DiskFormat-VolumeRemove-PartitionThe scanner is a guardrail, not a guarantee. Users should still inspect commands and managed scripts before execution.
Apache-2.0
.ps1 script files..ps1 script files..ps1 script files.npm installnpm run typechecknpm run buildnpm run devdiagnose_powershell7get_powershell7_configWrite-Host / Write-OutputWrite-Error.ps1 create/run/delete lifecycleC:\Program Files\PowerShell\7\pwsh.exe
POWERSHELL7_PATH_MODE=auto|manual
POWERSHELL7_MANUAL_PATH=C:\Program Files\PowerShell\7\pwsh.exe
POWERSHELL7_DEFAULT_TIMEOUT_SECONDS=30
POWERSHELL7_MAX_TIMEOUT_SECONDS=300
POWERSHELL7_STDOUT_MAX_BYTES=65536
POWERSHELL7_STDERR_MAX_BYTES=65536
POWERSHELL7_SCRIPTS_DIR=.powershell7-scripts
POWERSHELL7_AUDIT_LOG=.powershell7-audit.log
npm install
npm run typecheck
npm run build
npm run dev
npm run push
lms push
$PSVersionTable | ConvertTo-Json -Depth 4
Get-ChildItem
{
"fileName": "hello.ps1",
"content": "Write-Output \"Hello from PowerShell7\"",
"overwrite": true
}
{
"fileName": "hello.ps1"
}
{
"fileName": "hello.ps1"
}