@nodevisor/pwsh
v0.0.83
Published
Module provides PowerShell-related utility methods and properties
Downloads
342
Readme
@nodevisor/pwsh
Execute PowerShell commands for Windows-compatible automation.
Part of Nodevisor — TypeScript Infrastructure Automation Platform
Install
npm install @nodevisor/pwshQuick Start
import $ from '@nodevisor/shell';
import PWSH from '@nodevisor/pwsh';
const pwsh = $(PWSH);
// Run a PowerShell command
const version = await pwsh.command`$PSVersionTable.PSVersion.ToString()`.text();
console.log(version); // "7.4.1"
// Get system info
const hostname = await pwsh.command`hostname`.text();API
command(strings, ...values)
Execute a PowerShell command via pwsh -Command. Automatically handles PowerShell-specific quoting.
const pwsh = $(PWSH);
// Template literal syntax
const result = await pwsh.command`Get-Process | Select-Object -First 5`.text();
// With variables (escaped for PowerShell)
const name = 'notepad';
const proc = await pwsh.command`Get-Process -Name ${name}`.text();Returns a CommandBuilder, so you can chain output transforms:
const count = await pwsh.command`(Get-Process).Count`.trim().text();When It's Used
You typically don't use PWSH directly. It's used internally by:
@nodevisor/os— Windows-specific system commands@nodevisor/fs— Windows file operations
Related Packages
@nodevisor/os— Uses PWSH for Windows operations@nodevisor/shell— PowerShell quote handling
Documentation
Full documentation available at nodevisor.com/docs/packages/pwsh
License
Nodevisor uses a single O'Saasy license across all packages and applications. See the full terms in LICENSE.
