PowerShell is a command-line interface for Windows 10 and 11. It enables you to access and manipulate objects and automate tasks in Windows more easily than the Command Prompt. PowerShell cmdlets let you interact with your operating system and simplify complex tasks. Below is a list of all the essential PowerShell cmdlets and commands to help you accomplish basic and advanced tasks.
The PowerShell interface consists of a console window and an integrated scripting environment (ISE). It can perform operations like managing files and folders, manipulating registry entries, renaming files, configuring network settings, executing remote management actions, etc. From basic administrative tasks to advanced functions, PowerShell has limitless possibilities. There are PowerShell cmdlets for almost any system-level task. For example, you can use $PSVersionTable
to check the PowerShell version installed on your computer.
Basics of Windows PowerShell
Below are some basic PowerShell terms and shortcut keys you should know, especially if you are a beginner.
- Alias: An alternate or shorter name for a cmdlet, script, function, or executable file.
- Cmdlet: The internal commands of PowerShell are called “cmdlets”. Cmdlets are written in .NET Framework.
- Ctrl + C: Cancel the current command.
- F7: Shortcut key to view command history in a window.
- Functions: Commands written in PowerShell language.
- Home/End: Shortcut key to move to the start/end of a line.
- Insert: Shortcut key to toggle between insert/overwrite mode.
- Left/right arrow: Navigate the cursor.
- Ctrl + left/right arrow: Navigate a word at a time.
- Up/down arrow: Move up and down through history.
- Pipelines: A pipeline is an ASCII 124-character ( | ). It must be followed by a command that can handle the output passed through the pipeline.
- Parameter: Arguments to a cmdlet/function/script.
- PSdrives: A collection of entities that may be accessed as a filesystem drive. A PS session has access to several PSdrives such as c: (Windows c-drive), env: (Windows environmental variables), alias: (collection of cmdlet aliases), and HKLM: (a hive in the Registry).
- Scripts: A collection of PowerShell commands in a file with a .ps1 extension. The script is invoked from a PS session by entering its file name prefixed by its path.
- Tab/Shift-Tab: Shortcut key to complete commands as you type them.
- Variable: A unit of memory in which the data is stored. Variables usually start with a $ sign and include spaces and special characters.
To learn more about the Cmdlets, visit Microsoft’s website.
PowerShell Cmdlets and Command Alias
PowerShell cmdlets empower automation, streamline administrative tasks, and manipulate computer systems. The following useful cmdlets are essential for any beginner or system admin seeking to optimize their efficiency in managing Windows environments.
You can also download the complete cheat sheet of Windows PowerShell cmdlet PDF to use as a handbook.
Cmdlet Name | Command Alias | Description |
---|---|---|
Add-Content | ac | Adds content to the specified files. For instance, you can add words to a file. |
Add-PSSnapIn | asnp | Adds PowerShell snap-ins to the current session. |
Clear-Content | clc | Deletes the contents of a file while retaining the file. |
Clear-History | clhy | Deletes specific entries from the command history. |
Clear-Host | cls, clear | Removes all text (commands and output) from the current display and clears the PowerShell screen. |
Clear-ItemProperty | clp | Clears the value of a property. |
Clear-Variable | clv | Clears the value of a variable. |
Compare-Object | compare, dif | Compares two sets of objects directly by generating reports on the differences between the objects. |
Connect-PSSession | cnsn | Reconnects to the disconnected sessions. |
Copy-Item | copy, cp, cpi | Copies files and folders from a source file path to the destination file path. |
Copy-ItemProperty | cpp | Copies the value of a property from a specified location to another location. |
Disable-PSBreakpoint | dbp | Disables the breakpoints in the current PowerShell console. |
Disconnect-PSSession | dnsn | Disconnects from a PowerShell session. |
Enable-PSBreakpoint | ebp | Enables the breakpoints in the current PowerShell console. |
Enter-PSSession | etsn | Starts a PowerShell session with a remote computer. |
Exit-PSSession | exsn | Ends a PowerShell session with a remote computer. |
Export-Alias | epal | Exports information about currently defined aliases to a file. |
Export-Csv | epcsv | Converts objects into a series of character-separated values and saves the strings in a CSV file. |
Export-PSSession | epsn | Exports cmdlets and functions from another session on a computer and saves them in a PowerShell module. |
ForEach-Object | %, foreach | Performs modification or formatting on every item in a specified group of input objects (or items). |
Format-Custom | fc | Uses a customized view to display objects while retaining their basic structure. |
Format-List | fl | Formats the output of a command as a list of properties, showing each property on a new line. |
Format-Table | ft | Formats the output into table form. |
Get-Alias | gal | Gets the alias names for the cmdlets, functions, and scripts for the current session in PowerShell. If you want to find out or check the alias for a specific cmdlet, you can use Get-Alias -Definition cmdlet-name  or gal -d cmdlet-name . |
Get-ChildItem | gci, dir, ls | Gets the files and folders from one or more specified locations, such as a file system directory, registry hive, or certificate store. |
Get-Command | gcm | Displays the list of all PowerShell commands and functions. |
Get-Content | gc, type | Gets the contents from a file without opening it and returns each text file line as a string object. |
Get-Date | Gets the current date and time. | |
Get-Help | Helps you to get to know all the PowerShell commands, their parameters, functions, scripts, workflows, etc. | |
Get-History | h, ghy, history | Displays the list of the previous commands used in the current session. |
Get-HotFix | Gets hotfixes or updates that have been installed on either the local computer or remote computer. | |
Get-Item | gi | Gets files and folders at the specified location but doesn’t get the contents of the item unless you use a wildcard (*). |
Get-ItemProperty | gp | Gets the registry entries or values in the readable format in the console. |
Get-Job | gjb | Gets the list of jobs running in the background, and those completed in the current session. |
Get-Location | gl, pwd | Gets an object that represents the current directory within PowerShell. |
Get-Member | gm | Displays the properties, methods, and different members of an object. |
Get-Module | gmo | Displays the list of all the modules that are loaded behind the scenes. You can use the cmdlet Get-Module -ListAvailable to view the list of all available modules. A module is a collection of cmdlets, variables, functions, and workflows. |
Get-PSBreakpoint | gbp | Â Retrieves all current breakpoints that are set in the current session. This cmdlet can help you debug PowerShell. |
Get-PSCallStack | gcs | Displays the call stack or all commands executed in the current session. With this cmdlet, you can see a history of all commands run as part of a single execution step. |
Get-PSDrive | gdr | Displays the variety of drives exposed by Windows PowerShell in the current session. |
Get-PSSession | gsn | Displays the sessions created in the current Windows PowerShell session on local and remote computers. |
Get-PSSnapIn | gsnp | Displays the Windows PowerShell snap-in. |
Get-Process | ps, gps | Retrieves the list of all running applications and processes on a local or remote computer. It shows the process owner, the process ID, or even where on disk the process is located. |
Get-Service | gsv | Displays the list of all installed services, their status, and startup type on a local or remote computer. You can use parameters to include or exclude services. |
Get-Unique | gu | Returns unique items from a sorted list. PowerShell cmdlet Select-Object -Unique does the same job but does not require objects to be pre-sorted. |
Get-Variable | gv | Displays the names and the values of the variables in the current console. |
Get-WmiObject | gwmi | Searches for different WMI (Windows Management Instrumentation) classes on a system. Using this cmdlet, you can get any information about a Windows computer and its components. |
Group-Object | group | Groups similar objects together based on common properties. |
Import-Alias | ipal | Imports an alias list from a specified file in PowerShell. |
Import-Csv | ipcsv | Fetch the information contained in a CSV file and create a table-like structure. |
Import-Module | ipmo | Imports modules to the current session. |
Import-PSSession | ipsn | Imports command from a remote computer into the current session. |
Invoke-Command | icm | Runs a command or a script and returns the results as an expression on a local or remote computer. |
Invoke-Expression | iex | Runs a specified string as a command on the local computer. |
Invoke-History | r, ihy | Runs commands from the command history in the current session. |
Invoke-Item | ii | Runs or opens the specified item (depending on the file type) in the program associated with the file type. |
Invoke-RestMethod | irm | Sends HTTP or HTTPS requests using various HTTP methods to REST API endpoints. It is an alternative to Invoke-WebRequest. |
Invoke-WMIMethod | iwmi | Launches a create process WMI(Windows Management Instrumentation) method of the WIN32_Process class. |
Invoke-WebRequest | curl, iwr, wget | Sends HTTP, HTTPS, FTP, and FILE requests to a web page or web service on the Internet. |
mkdir | md | Creates a new directory. |
Measure-Object | measure | Measures how large an object is by calculating the numeric properties of the object in terms of characters, words, and lines. |
Move-Item | mi, mv, move | Moves a file, folder, or registry along with its properties, contents, and child items from one location to another location. |
Move-ItemProperty | mp | Moves the property of an item from one place to another. |
New-Alias | nal | Creates a new alias. |
New-Item | ni | Creates a new item. |
New-Module | nmo | Creates a dynamic module from a script block. |
New-PSDrive | ndr, mount | Creates a new temporary or persistent drive with various Windows PowerShell provider types. To create a new PSDrive you’ll need to provide a drive name, the provider, and the location. |
New-PSSession | nsn | Creates a persistent connection to a local or remote computer. |
New-PSSessionConfigurationFile | npssc | Creates a persistent PowerShell connection to a local or remote host. |
New-Variable | nv | Creates a new variable by simply assigning it a value. |
Out-GridView | ogv | Displays data as an interactive table (the GUI format) that can be filtered or sorted based on different criteria. |
Out-Host | oh | Sends output to the Windows PowerShell host for display. |
Out-Printer | lp | Sends output to the connected printer. |
Pop-Location | popd | Changes the current location to the path at the top of the directory stack. |
Push-Location | pushd | Pushes or adds the current location to the top of a location stack called ‘Paths’ and sets the C:\Program Files\PowerShell\ directory as the current directory. |
Receive-Job | rcjb | Fetches the results of Windows PowerShell background jobs, such as those started by using the Start-Job cmdlet. |
Receive-PSSession | rcsn | Fetches the results of PowerShell sessions that were disconnected intentionally using the Disconnect-PSSession cmdlet. |
Remove-Item | del, erase, rd, ri, rm, rmdir | Deletes items from specific locations like files, folders, registry keys, variables, and functions. You can use parameters to include or exclude items. Refer to our detailed guide on deleting files and folders with PowerShell. |
Remove-ItemProperty | rp | Deletes registry values and stored data of an item. |
Remove-Job | rjb | Deletes a Windows PowerShell background job. Deletes n stopped or completed background job in PowerShell, You need to mention the ‘-id n’ or ‘-name xxx’ to specify the job you want to remove. |
Remove-Module | rmo | Deletes module objects (cmdlets and functions) from the PowerShell session. |
Remove-PSBreakpoint | rbp | Disables the breakpoint from the current console so they are not hit when the script runs. |
Remove-PSDrive | rdr | Removes temporary PowerShell drives created with New-PSDrive. To remove multiple drives together, you should separate them using a comma (,). |
Remove-PSSession | rsn | Closes PowerShell session, stops any running commands in the current session, ends the PSSession, and closes the connection between the local and remote computers. |
Remove-PSSnapin | rsnp | Unloads a snap-in from the current PowerShell session. |
Remove-Variable | rv | Removes the variable and its value defined in PowerShell. |
Remove-WMIObject | rwmi | Removes a WMI (Windows Management Instrumentation) class. |
Rename-Item | ren, rni | Renames files and folders in a PowerShell provider namespace. To learn more about this cmdlet, head to our detailed tutorial on renaming files using PowerShell. |
Rename-ItemProperty | rnp | Renames an item’s property without changing its value. |
Resolve-Path | rvpa | Resolves the wildcard characters in a path and displays the items and containers at the location specified by the path. |
Resume-Job | rujb | Resumes a suspended job. |
Select-Object | select | Selects specific properties from an object or dataset. |
Select-String | sls | Searches for text and text patterns in input strings and files. |
Set-Alias | sal | Creates or changes an alias (alternate name) for a cmdlet or other command element in the current PowerShell session. |
Set-Content | sc | Writes or replaces the content in an item with new content. |
Set-Item | si | Changes the value of an item to the value specified in the command. |
Set-ItemProperty | sp | Sets the value of the property of the specified object. |
Set-Location | cd, chdir, sl | Changes the current directory or location to a location you specify. |
Set-PSBreakpoint | sbp | Sets the line breakpoint in the script. |
Set-Variable | set, sv | Assigns a value to a variable or changes the current value. If the specified variable doesn’t exist, the cmdlet will create it. |
Show-Command | shcm | Finds the parameters and syntax of other PowerShell cmdlets graphically. |
Sort-Object | sort | Sorts objects in ascending or descending order based on the values of properties. |
Start-Job | sajb | Starts a Windows PowerShell background job without interacting with the current session. |
Start-Process | saps, start | Starts single or multiple processes on the local computer. |
Start-Service | sasv | Start one or more stopped services on the system. |
Start-Sleep | sleep | Suspends the activity in a script or session for a certain period. |
Stop-Job | spjb | Stops all or stops selected jobs based on their name, ID, instance ID, or state. |
Stop-Process | kill | Forcibly kills or stops the running processes. |
Suspend-Job | sujb | Suspends workflow jobs by temporarily interrupting or pausing them. |
Wait-Job | wjb | Suspends the command prompt until the PowerShell background tasks running in the session are complete. |
Where-Object | ?, where | Filters objects based on their property values. |
Write-Output | echo, write | Sends any object or data type, such as strings, integers, arrays, and complex objects to the next command in the pipeline. |
Once you get acquainted with the extensive range of PowerShell commands and cmdlets, you can perform tasks on your Windows PC like a pro. If you think I missed any essential command in this list, please leave a comment.
Read Next: How to Partition C Drive in Windows 10 & 11 without Formatting