Call Windows PowerShell from WSL (Windows Subsystem for Linux) to control Windows from Linux environment.
- โ Support Windows PowerShell and PowerShell Core
- โ Automatic path conversion (WSL โ Windows)
- โ Error handling and debug mode
- โ Command and script file execution modes
- โ Comprehensive help and version info
- โ Colored log output
# Clone to OpenClaw workspace skills directory
cd ~/.openclaw/workspace/skills
git clone https://github.com/TYzzt/wsl-powershell.git
# Add execute permission
chmod +x wsl-powershell/scripts/psctl.shFor Agents: Restart OpenClaw session after cloning, skill will auto-load.
# Install ClawHub CLI
npm install -g clawhub
# Login
clawhub login
# Install skill
clawhub install wsl-powershell# Download ZIP
wget https://github.com/TYzzt/wsl-powershell/archive/refs/heads/main.zip
unzip main.zip -d ~/.openclaw/workspace/skills/
mv ~/.openclaw/workspace/skills/wsl-powershell-main ~/.openclaw/workspace/skills/wsl-powershell
# Add execute permission
chmod +x ~/.openclaw/workspace/skills/wsl-powershell/scripts/psctl.sh# Execute PowerShell command
./scripts/psctl.sh "Get-Process | Select-Object -First 5 Name,Id"
# Execute PowerShell script file
./scripts/psctl.sh -f /mnt/c/scripts/myscript.ps1
# Check PowerShell availability
./scripts/psctl.sh --check# Get system info
./scripts/psctl.sh "Get-ComputerInfo | Select-Object WindowsProductName,WindowsVersion"
# Get process list
./scripts/psctl.sh "Get-Process | Sort-Object CPU -Descending | Select-Object -First 10 Name,Id,CPU"
# Get service status
./scripts/psctl.sh "Get-Service | Where-Object {\$_.Status -eq 'Running'} | Select-Object -First 10 Name,DisplayName"# List directory
./scripts/psctl.sh "Get-ChildItem C:\\Users"
# Copy file
./scripts/psctl.sh "Copy-Item C:\\source\\file.txt C:\\dest\\file.txt -Force"
# Create file
./scripts/psctl.sh "New-Item -Path C:\\test.txt -ItemType File -Force"# Start program
./scripts/psctl.sh "Start-Process notepad.exe"
# Stop process
./scripts/psctl.sh "Stop-Process -Name notepad -Force"# Get network config
./scripts/psctl.sh "Get-NetIPConfiguration | Select-Object InterfaceAlias,IPv4Address"
# Ping test
./scripts/psctl.sh "Test-Connection -ComputerName google.com -Count 2"# Show help
./scripts/psctl.sh --help
# Show version
./scripts/psctl.sh --version
# Debug mode
DEBUG=1 ./scripts/psctl.sh "Get-Process"
# Verbose output
./scripts/psctl.sh -v "Get-Service"
# Use PowerShell Core
./scripts/psctl.sh -p "Get-Module -ListAvailable"
# Check PowerShell availability
./scripts/psctl.sh --check-
Permissions: Some operations require administrator privileges
# Start elevated PowerShell ./scripts/psctl.sh "Start-Process powershell -Verb RunAs"
-
Path Escaping: Backslashes
\in Windows paths must be escaped as\\ -
Execution Policy: Running scripts may require setting execution policy
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
-
Encoding: PowerShell outputs UTF-16 by default, may need conversion
โ ๏ธ Use caution with system-level commandsโ ๏ธ Avoid deleting critical system filesโ ๏ธ Test commands before executing in productionโ ๏ธ Do not execute scripts from untrusted sources
Issues and Pull Requests are welcome!
- Fork the project
- Create feature branch (
git checkout -b feature/AmazingFeature) - Commit changes (
git commit -m 'Add some AmazingFeature') - Push to branch (
git push origin feature/AmazingFeature) - Open Pull Request
Apache-2.0 License - see LICENSE file for details.
- WSL - Windows Subsystem for Linux
- PowerShell - PowerShell Core
OpenClaw automatically scans these directories for skills:
~/.openclaw/workspace/skills/- Main workspace skills./skills/- Skills in current working directory
After installation, restart OpenClaw session and the skill will auto-load. Agents can:
-
Call script directly:
~/.openclaw/workspace/skills/wsl-powershell/scripts/psctl.sh "PowerShell command"
-
Learn from skill description:
- Agent reads
SKILL.mdto understand skill capabilities - Automatically uses this skill based on user requests
- Agent reads
-
Example scenarios:
- "Check Windows Update policy"
- "List Windows processes"
- "Get system information"
- Repository: github.com/TYzzt/wsl-powershell
- Clone:
git clone https://github.com/TYzzt/wsl-powershell.git - ClawHub:
clawhub install wsl-powershell