PowerShell Command Reference

9 October 2025 · Updated 9 October 2025

commandspowershellwindowsreference

PowerShell commands I come back to on Windows. Same shape as the Linux reference: grouped by task, not alphabetically.

SSH Key Management

Generate ED25519 SSH Key

ssh-keygen -t ed25519 -C "Comment"

Source: PowerShell Commands

Use when: Creating modern, secure SSH keys for authentication

Generate RSA SSH Key

ssh-keygen -t rsa -b 2048 -C ""

Source: PowerShell Commands

Use when: Legacy systems require RSA keys

Transfer SSH Key to Linux Server

type $env:USERPROFILE\.ssh\id_ed25519.pub | ssh user@remote-host "cat >> .ssh/authorized_keys"

Source: Adding SSH Keys to Linux Servers

Use when: Setting up passwordless SSH from Windows to Linux


User and Password Management

Reset Local Administrator Password

$NewPassword = ConvertTo-SecureString "Windozer69" -AsPlainText -Force
Set-LocalUser -Name Administrator -Password $NewPassword

Source: PowerShell Commands

Use when: Need to reset local Windows account password


Hyper-V Virtual Disk Management

Create Dynamic Virtual Hard Drive

New-VHD -Path C:\VHDX\example.vhdx -SizeBytes 30GB -Dynamic -BlockSizeBytes 1MB

Source: PowerShell Commands

Use when: Creating VHDs for Hyper-V virtual machines

Note: Dynamic VHDs grow as needed up to the specified size


Software Installation (winget)

Install ImageMagick

winget install ImageMagick.ImageMagick

Source: PowerShell Commands

Install FFmpeg

winget install Gyan.FFmpeg

Source: FFMPEG


Environment Configuration

Add FFmpeg to System PATH

[System.Environment]::SetEnvironmentVariable("Path", $Env:Path + ";C:\Users\ST02206\AppData\Local\Microsoft\WinGet\Packages\Gyan.FFmpeg_Microsoft.Winget.Source_8wekyb3d8bbwe\ffmpeg-7.1-full_build\bin", [System.EnvironmentVariableTarget]::Machine)

Source: FFMPEG

Use when: Making FFmpeg available system-wide after winget install


Microsoft Intune

Force Intune Policy Sync

Get-ScheduledTask 'PushLaunch' | Start-ScheduledTask

Source: Force Intune Sync

Use when: Need immediate policy update from Intune


Certificate Management

Request SSL Certificate from Windows CA

certreq -attrib "CertificateTemplate:WebServerSecureCertificate"

Source: Netbox Setup

Use when: Requesting certificates from Windows Certificate Authority


OpenSSL via Git Bash on Windows

Convert Certificate to PFX Format

. "C:\Program Files\Git\usr\bin\openssl.exe" pkcs12 -export -out domain.tld.pfx -inkey domain.tld.key -in domain.tld.cer -certfile chain.cer

Source: Update SSL Certs in Nutanix Cluster

Use when: Converting certificates for Nutanix import

View RSA Private Key Details

. "C:\Program Files\Git\usr\bin\openssl.exe" rsa -in solution-one.com.au.key -text -noout

Source: Update SSL Certs in Nutanix Cluster

Decrypt Encrypted Private Key

. "C:\Program Files\Git\usr\bin\openssl.exe" rsa -in solution-one.com.au.key -out solution-one.com.au-unencrypted.key

Source: Update SSL Certs in Nutanix Cluster

Use when: Removing passphrase from private key

View X.509 Certificate Details

. "C:\Program Files\Git\usr\bin\openssl.exe" x509 -in solution-one.com.au.pem -text -noout

Source: Update SSL Certs in Nutanix Cluster

Convert DER Certificate to PEM

. "C:\Program Files\Git\usr\bin\openssl.exe" x509 -inform DER -in solution-one.com.au.cer -out solution-one.com.au.pem

Source: Update SSL Certs in Nutanix Cluster

Use when: Converting between certificate formats


Shell Configuration

Reload PowerShell Profile

. $PROFILE

Source: Starship PowerShell Configuration

Use when: Applied changes to PowerShell profile

Reload Starship Prompt Configuration

$env:STARSHIP_CONFIG = "$env:USERPROFILE\.config\starship.toml"

Source: Starship PowerShell Configuration

Use when: Changed Starship configuration file


File Transfer

SFTP File Transfer (Single Command)

echo "put C:\path\to\local\file.txt /remote/path/" | sftp username@hostname

Source: SFTP over SSH from Windows to Linux Server

Use when: Quick one-off file transfer to Linux server

Examples:

# Transfer single file
echo "put C:\Users\John\Documents\data.txt /home/user/uploads/" | sftp user@192.168.1.100

# Transfer with custom port
echo "put C:\file.txt /home/user/" | sftp -P 2222 user@server.com

See also: SFTP Command Reference


  • Linux Command Reference - Bash/shell equivalents
  • SFTP Command Reference - File transfer details
  • SSH Command Reference - SSH configuration and usage

Tips and Best Practices

PowerShell vs CMD

  • Use PowerShell for modern Windows administration
  • PowerShell provides object-oriented output (not just text)
  • Native SSH client available in Windows 10+ PowerShell

Execution Policy

If scripts won’t run, check execution policy:

Get-ExecutionPolicy
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Module Installation

Install useful modules from PowerShell Gallery:

Install-Module -Name PSReadLine -Force
Install-Module -Name Terminal-Icons -Repository PSGallery

Last Updated: 2025-10-09 Commands: 18 commands from 8 source files