Solutions for common issues with the PowerShell Dev Toolkit
- Installation Issues
- Script Execution Issues
- SSH Connection Issues
- Command Not Found
- Configuration Issues
- Development Server Issues
- WSL Issues
Problem: Setup-Environment.ps1 fails or doesn't complete.
Solutions:
- Run PowerShell as Administrator
- Check execution policy:
Get-ExecutionPolicy Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
- Run setup manually:
.\Setup-Environment.ps1 -Verbose
Problem: Commands aren't available after setup.
Solutions:
-
Reload your profile:
. $PROFILE
-
Check if profile exists:
Test-Path $PROFILE
-
Manually update profile:
.\Setup-Environment.ps1 -UpdateProfile
-
Verify profile contents:
notepad $PROFILE
Problem: File cannot be loaded because running scripts is disabled on this system
Solution:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserProblem: Script blocked due to signature requirements.
Solution:
# Option 1: Allow local scripts
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
# Option 2: Bypass for current session only
powershell -ExecutionPolicy Bypass -File .\script.ps1Problem: Access denied when running scripts.
Solutions:
-
Run as Administrator:
sudo .\script.ps1
-
Check file permissions:
Get-Acl .\script.ps1 | Format-List
Problem: Credential file not found!
Solution:
# Create creds directory
New-Item -Path ".\creds" -ItemType Directory -Force
# Store credentials
$cred = Get-Credential -UserName 'your-ssh-username'
$cred | Export-Clixml '.\creds\ssh-credentials.xml'Problem: No SSH method available.
Solutions:
-
Install WSL (Recommended):
wsl --install # Restart computer after installation
-
Install Posh-SSH:
Install-Module -Name Posh-SSH -Scope CurrentUser -Force
Problem: SSH connection times out.
Solutions:
- Check server hostname in
config.json - Verify network connectivity:
Test-NetConnection -ComputerName server.example.com -Port 22
- Check firewall settings
- Verify VPN connection if required
Problem: SSH authentication fails.
Solutions:
- Verify username is correct
- Re-create credential file:
$cred = Get-Credential -UserName 'correct-username' $cred | Export-Clixml '.\creds\ssh-credentials.xml'
- Test password manually:
wsl ssh your-username@server.example.com
Problem: Cannot install sshpass in WSL.
Solutions:
-
Update WSL packages first:
wsl bash -c "sudo apt-get update" wsl bash -c "sudo apt-get install -y sshpass"
-
If apt fails, check WSL distribution:
wsl --list --verbose
Problem: Connection refused when using tunnel.
Solutions:
- Check if the remote service is running
- Verify the remote port is correct
- Check if the local port is already in use:
port <local-port>
- Try a different local port:
tunnel myserver postgres 5433
Problem: Commands like cssh, serve, gs not recognized.
Solutions:
-
Reload profile:
. $PROFILE
-
Re-run setup:
.\Setup-Environment.ps1 -UpdateProfile
-
Check if scripts exist:
Test-Path "$PSScriptRoot\Connect-SSH.ps1"
-
Manually add to profile:
notepad $PROFILE # Add: Set-Alias cssh "C:\path\to\Connect-SSH.ps1"
Problem: Alias conflicts with existing commands.
Solution: Check for conflicts:
Get-Alias <alias-name>
Get-Command <command-name>Remove conflicting alias:
Remove-Alias <alias-name>Problem: Scripts fail because config.json doesn't exist.
Solution:
Copy-Item config.example.json config.json
notepad config.jsonProblem: ConvertFrom-Json error when loading config.
Solutions:
-
Validate JSON syntax:
Get-Content config.json | ConvertFrom-Json
-
Common JSON issues:
- Missing commas between properties
- Trailing commas (not allowed in JSON)
- Unescaped backslashes (use
\\in paths)
-
Reset to example:
Copy-Item config.example.json config.json
Problem: Paths with spaces cause errors.
Solution:
Always quote paths in config.json:
{
"editor": {
"notepadPlusPlus": "C:\\Program Files\\Notepad++\\notepad++.exe"
}
}Problem: serve fails because port is in use.
Solutions:
-
Find what's using the port:
port 3000 -
Kill the process:
port 3000 -Kill
-
Use a different port:
serve -Port 8080
Problem: serve doesn't detect project type.
Solutions:
-
Check for project files:
Test-Path package.json Test-Path composer.json
-
Force server type:
serve php serve node serve python
-
Check project info:
proj
Problem: serve fails for Node projects.
Solution:
# Check if Node is installed
node --version
npm --version
# If not, install from https://nodejs.org/
# Then reload terminalProblem: PHP server fails to start.
Solution:
# Check PHP installation
php --version
# If not in PATH, add it or use full path in configProblem: WSL commands fail.
Solution:
# Install WSL
wsl --install
# Restart computer
# Then set up default distribution
wsl --set-default UbuntuProblem: The Windows Subsystem for Linux has no installed distributions
Solution:
# List available distributions
wsl --list --online
# Install Ubuntu (recommended)
wsl --install -d Ubuntu
# Set as default
wsl --set-default UbuntuProblem: WSL can't access network resources.
Solutions:
-
Restart WSL:
wsl --shutdown wsl -
Check DNS in WSL:
wsl cat /etc/resolv.conf
-
Reset WSL networking:
wsl --shutdown netsh winsock reset # Restart computer
Run scripts with verbose output:
$VerbosePreference = "Continue"
.\Script.ps1# PowerShell version
$PSVersionTable.PSVersion
# Git
git --version
# WSL
wsl --version
# Node
node --version
# PHP
php --versionIf all else fails:
# 1. Remove profile additions
notepad $PROFILE
# Remove toolkit-related lines
# 2. Re-run setup
.\Setup-Environment.ps1
# 3. Reload profile
. $PROFILE
# 4. Test
helpmeIf you're still stuck:
- Check GitHub Issues
- Open a new issue with:
- PowerShell version (
$PSVersionTable.PSVersion) - Windows version (
[System.Environment]::OSVersion) - Error message (full text)
- Steps to reproduce
- PowerShell version (