Skip to content

PowerShell

January 9, 2025
May 19, 2023

PowerShell Documentation - PowerShell | Microsoft Learn
What is PowerShell? - PowerShell | Microsoft Docs
Differences between Windows PowerShell 5.1 and PowerShell 7.x - PowerShell | Microsoft Docs

Introduction - PowerShell | Microsoft Learn
Windows PowerShell Lets You Automate Anything on Your PC: Here's How to Start

PoshCode/poshcode.github.io: github pages
About this Guide - PowerShell Practice and Style
PoshCode/PowerShellPracticeAndStyle: The Unofficial PowerShell Best Practices and Style Guide

Awesome Rank for janikvonrotz/awesome-powershell

# allow scripts
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Use "`" to escape ";" (like "" in Linux)

PSWindowsupdate: Automated Windows Updates with PowerShell - Virtualization Howto

How To Use PS2EXE to Turn PowerShell Scripts Into EXE Files | ITPro Today: IT News, How-Tos, Trends, Case Studies, Career Tips, More
Make Portable PowerShell EXEs Without External Dependencies (Tutorial)

PowerShell Screen Captures: Automate Screenshots in Your Scripts

Powershell Tutorial - Tutorialspoint
Getting Started with PowerShell
Learning PowerShell: The basics | Computerworld PowerShell primers series
PowerShell Tutorials - Stephanos Constantinou Blog
PowerShell - Simple Talk

Initial page - PowerShell FAQ
PowerShell commands - PowerShell - SS64.com
PowerShell Core Commands - Stephanos Constantinou Blog
The 16 Best PowerShell Commands (Cmdlets) You Must Know
powershell Archives - ShellHacks

How To Use PowerShell’s Get-Date Cmdlet To Create Timestamps
How To Create Custom PowerShell Cmdlets Using Modules (Video Tutorial)
Top 10 PowerShell Tips and Tricks of 2024 (So Far)
Make Portable PowerShell EXEs Without External Dependencies (Tutorial)
How I Built a PowerShell Multi-File Search Tool (With Source Code)
How To Build a Disk Space Pie Chart in PowerShell

lextm/windowsterminal-shell: Install/uninstall scripts for Windows Terminal context menu items
Hosting PowerShell in a Python script - PowerShell Team

How to Debug a PowerShell Script – CloudSavvy IT

Profile

about Profiles - PowerShell | Microsoft Learn
Understanding the Six PowerShell Profiles - Scripting Blog

~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
~\OneDrive\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 if OneDrive is setup

Providers

about_Providers - PowerShell | Microsoft Docs
PowerShell Providers - Stephanos Constantinou Blog
All about PowerShell providers and modules | Computerworldv

Alias - Windows PowerShell aliases {Alias}
Certificate - X509 certificates for digital signatures {cert}
Environment - Windows environment variables {Env}
FileSystem - File system drives, directories and files {filesystem}
Function - Windows PowerShell functions {Function}
Registry - Windows registry {HKLM, HKCU}
Variable - Windows PowerShell variables {Variable}

Environment Variables

Use PowerShell to Set Environment Variables
Windows Environment variables - PowerShell - SS64.com

# show environment variables
Get-Childitem env: | sort name
ls env:
echo $Env:PATH
echo $Env:USERPROFILE

# using variable
ls $Env:USERPROFILE

# set variable
$env:Variable = 'value'

Persist Environment Variables

# scoped to the User
[System.Environment]::SetEnvironmentVariable('Variable','value',[System.EnvironmentVariableTarget]::User)
# scoped to the Machine
[System.Environment]::SetEnvironmentVariable('Variable','value',[System.EnvironmentVariableTarget]::Machine)

Unix command equivalents

PowerShell equivalents for common Linux/bash commands - TheShellNut
Get-Command (Microsoft.PowerShell.Core) - PowerShell | Microsoft Learn gcm shows all commands
Windows: Grep Equivalent - CMD & PowerShell - ShellHacks

UnixPowerShell
pwdGet-Location
lsGet-Childitem/ls
test -eTest-Path
which/typeGet-Command
xdg-openStart-Process
grepfindstr/Select-String
find . -type f -iname <filter>Get-ChildItem -Filter <filter> -Recurse -File
cpCopy-Item/cp
rmRemove-Item/rm
touchNew-Item
catGet-Content/type
manGet-Help/help

CmdletBinding

about_Functions_CmdletBindingAttribute - PowerShell | Microsoft Docs
about_Functions_Advanced_Parameters - PowerShell | Microsoft Docs
about_Functions_CmdletBindingAttribute - PowerShell | Microsoft Docs
PowerShell advanced functions – The CmdletBinding and Parameter attribute – 4sysops

# parsing argument
[CmdletBinding()]
param()

.NET in PowerShell

Enhancing PowerShell With Microsoft .NET Framework
Integrate Microsoft .NET Classes Into PowerShell Scripts
How To Use .NET Properties and Methods in PowerShell

.NET API browser | Microsoft Learn

UI in PowerShell

How To Create an Interactive PowerShell Menu
Intro to Microsoft Dialog Boxes in PowerShell
How I Built a PowerShell Multi-File Search Tool (With Source Code)
PowerShell Dialog Boxes: Using Button Click Actions and Menu Selections
How To Create Responsive Dialog Boxes in PowerShell
PowerShell Screen Captures: Automate Screenshots in Your Scripts
How To Use PowerShell and WPF To Create Advanced GUIs
Generate Windows toast notifications with the PowerShell module BurntToast – 4sysops

Session Manager

Poor-man's Tmux

# script to setup a tmux-like environment
# $workspace_root = $env:USERPROFILE\src\project
$workspace_root = C:\src\project

$commands = @"
  nt -d $workspace_root --title Project `;
  nt -d $workspace_root --title Project `;
  nt -d $env:APPDATA\ --title "App data"
"@

# echo "wt $command_arr"
Start-Process wt -ArgumentList $command_arr