VOOZH about

URL: https://ss64.com/ps/syntax.html

⇱ PowerShell How-to guides - PowerShell cmdlet


Windows PowerShell How-to guides and examples

Parameters Command Line Parameters param() and $args[]
Pipelines Pass objects down the pipeline.
Objects Working with objects.
Looping commands: Do, ForEach, ForEach-Object, Switch, While
Date&Time Date and Time Format patterns (DateTimeFormatInfo).
Redirection Spool output to a file.
Statements Looping, If-Then-Else.
Tab Completion for Cmdlets, Filenames & Variables.
Transactions Manage transactions.

Variables

Create Variables and assign values  Basic Operators: + - / =
Arrays and Hash tables.
Automatic variables $_, $Args, $myinvocation etc
Preference variables Verbosity, Confirmations, ErrorAction, $Debug
Ref variables Pass a reference variable to a function.
Environment variables $Env: & PowerShell providers.

Evaluate expressions

Escape characters Delimiters, Here Strings and "quotes".
Comparison -like, -lt, -gt, -eq, -ne, -match
DataTypes PowerShell data types.
ParseExact Convert a String to a DateTime.
Enums Create and use PowerShell enums.
Methods ToUpper(), PadRight(), Split(), Substring(), Replace() etc.
.Net Math Round(), Ceiling(), Max(), Min()
Operators Format strings and arrays @( ) -f [ ] $( ) :: &
Concat Several methods to combine strings together.
Regular Expressions  Search and/or Replace.
Replace Basic Search/Replace in strings and files.
Wildcards Match multiple items.

Functions and Modules

Scriptblock A collection of statements: { … }
Functions and Filters Write a named block of code.
Function Input Processing  (Begin..Process..End)
Advanced Functions Adding ValidateSet and Help, a function template to copy.
Assertions Use a filter to assert certain prerequisite conditions.
Modules Combine functions into a module for easy re-use.

Example scripts and functions

Run a script How to run a PowerShell .ps1 script or a CMD batch file.
Base36 Convert numbers to/from base 36.
CD - Function to jump back to the previous working directory.
Console Size Set the PowerShell console window size.
DelOlder Delete files and folders older than n days.
DirUse List the size of subfolders.
DisplayRes Get the display resolution of multiple computers.
Check-Backups Check multiple locations for files that have changed.
Get-Bandwidth List the average IO for a Network interface.
Get-BankHolidaysUK Retrieve UK Bank Holidays from a web service.
Get-DateOfEaster Calculate the date of Easter.
Get-DiskSpace List the free disk space for multiple computers.
Get-OSVersion Get the OS and Service pack level of a remote machine (inventory).
Get-Programs List Installed Software (Programs & Features).
Get-AdvTarget Find the target of an Advertised Shortcut.
Get-Uptime Get the system uptime for one or more computers.
Get-Windows-Key  Retrieve the Windows product key.
Set-KnownFolderPath Get or Set Special 'Known' Folders.
Logged On Who is logged in / where is a user logged in.
Function:
Get-Loggedon
Get a list of Logged on users
LastLogon Find when an account last logged in.
Lock-Workstation Lock the current interactive session.
MsgBox A function to display messages in a popup message box.
New-Shortcut Create a Shortcut.
Password expiry Reminder email.
pshInfo List Ram, Disk Space, Service pack, Uptime.
psp PowerShell Ping.
ms-settings: Open Settings
Set-LastWrite Reset Folder Last Modified to the most recent file in the folder.
ServiceStatus List installed services and service status.
Set-EOL Change the line endings (CR/LF) of a text file.
StampMe Rename a file with the current Date/Time.
Template Template for a Basic PowerShell script.
Touch Change the date/time of a file/folder.
Video Converter A simple GUI front end for the FFmpeg video converter (compress/resize).

Reference

AD/LDAP Active Directory / LDAP User Attributes.
Lightweight Directory Access Protocol (LDAP) .
Elevate Run with elevated permissions (As Admin).
Colours How to set terminal colours in PowerShell.
Comments How to comment your scripts including Comment-based help.
Circular Find circular nested AD groups.
Event IDs The most common Windows Event IDs.
Keyboard Keyboard shortcuts for CMD/PowerShell and Windows Terminal.
Open Here Open PowerShell from any folder.
PS verbs Naming convention (Technet).
$Profile The PowerShell startup $Profile.
Prompt Configure the PowerShell prompt.
Remote  Run a PowerShell script on a remote computer.
#requires Prevent a script from running without a required element.
Restore Restore selected (zero byte) files from a backup
Verbs Approved Verbs for PowerShell.
OS Version How to retrieve the OS version in PowerShell.
Word How to automate MS Word in PowerShell using a COM object.

See also: Websites, additional cmdlets, Utilities and Books for PowerShell.


Copyright © 1999-2026 SS64.com
Some rights reserved