
Security News
OpenClaw Skill Marketplace Emerges as Active Malware Vector
Security researchers report widespread abuse of OpenClaw skills to deliver info-stealing malware, exposing a new supply chain risk as agent ecosystems scale.
powershell-utils
Advanced tools
Utilities for executing PowerShell commands
npm install powershell-utils
import {executePowerShell, powerShellPath} from 'powershell-utils';
const {stdout} = await executePowerShell('Get-Process');
console.log(stdout);
console.log(powerShellPath());
//=> 'C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe'
Returns: string
Get the PowerShell executable path on Windows.
import {powerShellPath} from 'powershell-utils';
const psPath = powerShellPath();
//=> 'C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe'
Returns: Promise<boolean>
Check if PowerShell is accessible on Windows.
This checks if the PowerShell executable exists and has execute permissions. Useful for detecting restricted environments where PowerShell may be disabled by administrators.
import {canAccessPowerShell} from 'powershell-utils';
if (await canAccessPowerShell()) {
console.log('PowerShell is available');
} else {
console.log('PowerShell is not accessible');
}
Returns: Promise<{stdout: string, stderr: string}>
Execute a PowerShell command.
import {executePowerShell} from 'powershell-utils';
const {stdout} = await executePowerShell('Get-Process');
console.log(stdout);
Type: string
The PowerShell command to execute.
Type: object
The below option and also all options in Node.js child_process.execFile() are supported.
Type: string
Default: powerShellPath()
Path to PowerShell executable. Useful when calling from WSL or when PowerShell is in a non-standard location.
Type: string
Default: 'utf8'
Character encoding for stdout and stderr.
Type: string[]
Standard PowerShell arguments that prefix the encoded command: ['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-EncodedCommand']
Exposed for debugging or for advanced use cases where you need to customize the arguments. For most cases, use createArguments() instead.
Returns: string
Encode a PowerShell command as Base64 UTF-16LE.
This encoding prevents shell escaping issues and ensures complex commands with special characters are executed reliably.
Type: string
The PowerShell command to encode.
import {executePowerShell} from 'powershell-utils';
const encoded = executePowerShell.encodeCommand('Get-Process');
Returns: string
Escape a string argument for use in PowerShell single-quoted strings.
Type: unknown
The value to escape.
import {executePowerShell} from 'powershell-utils';
const escaped = executePowerShell.escapeArgument("it's a test");
//=> "'it''s a test'"
// Use in command building
const command = `Start-Process ${executePowerShell.escapeArgument(appName)}`;
Returns: string[]
Create the full arguments array for PowerShell execution.
Combines argumentsPrefix with the encoded command. Useful when using spawn(), execFile(), or other process execution methods.
Type: string
The PowerShell command.
import {spawn} from 'node:child_process';
import {powerShellPath, executePowerShell} from 'powershell-utils';
const args = executePowerShell.createArguments('Get-Process');
spawn(powerShellPath(), args);
Returns: string
Execute a PowerShell command synchronously.
import {executePowerShellSync} from 'powershell-utils';
const stdout = executePowerShellSync('Get-Process');
console.log(stdout);
Type: string
The PowerShell command to execute.
Type: object
The below option and also all options in Node.js child_process.execFileSync() are supported.
Type: string
Default: powerShellPath()
Path to PowerShell executable.
Type: string
Default: 'utf8'
Character encoding for the output.
FAQs
Utilities for executing PowerShell commands
The npm package powershell-utils receives a total of 1,609,535 weekly downloads. As such, powershell-utils popularity was classified as popular.
We found that powershell-utils demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Security researchers report widespread abuse of OpenClaw skills to deliver info-stealing malware, exposing a new supply chain risk as agent ecosystems scale.

Security News
Claude Opus 4.6 has uncovered more than 500 open source vulnerabilities, raising new considerations for disclosure, triage, and patching at scale.

Research
/Security News
Malicious dYdX client packages were published to npm and PyPI after a maintainer compromise, enabling wallet credential theft and remote code execution.