Windows PowerShell's Cmdlets (Built-In)

Windows PowerShell Cmdlets (Built-In)

On this page I define the word cmdlet to mean a built-in PowerShell command, with a single Verb-Noun pair.  There is another shade of meaning to cmdlet, namely a series of commands, usually more than one line, stored in a text file with a .ps1 extension.

PowerShell Cmdlets Lists of the 13 Sections

  1. System Built-In Cmdlets
  2. Objects Built-In Cmdlets
  3. Items Built-In Cmdlets
  4. Aliases Built-In PowerShell Cmdlets
  5. Drives Built-In Cmdlets
  6. Paths and locations
  7. Contents Built-In PowerShell Cmdlets
  8. Access Operating System Components
  9. Output Formatters Built-In Cmdlets
  10. Variables
  11. Security Built-In Cmdlets
  12. Miscellaneous PowerShell Built-In Cmdlets
  13. Debugging


PowerShell Build-In Cmdlet Categories

1) System Built-In PowerShell Cmdlets

a) Get-Help.  This is the best command to explore the built-in PowerShell library.  As with many cmdlets, it begins with the verb 'get'.  Example: Get-Help alias.  Remember that Get-Help supports wildcards, for example type:
Get-Help *object.

b) Get-Command.  Returns a list of available commands.  Get-Command really is the entire command, I was expecting more, but this cmdlet is only two words, get and command separated by a hyphen.  You may wish to try a wild card, for example Get-Command c*

c) Get-Host.  Displays information about the PowerShell host. (Not to be confused with hostname.)  Try this command to check your version number.  $PSVersionTable

d) Get-Culture.  Shows you information about the regional settings of the host (as defined in the Regional Settings of the Control Panel)

e) Get-UiCulture Returns information about the regional settings of the host as defined by the selected language on a multi-language operating system.

See more about key system cmdlets here »

2) Objects Built-In PowerShell Cmdlets

a) Get-Member.  This is by far the most important cmdlet for research.  Get-Member enumerates properties, methods and type information of the objects; for example:

Get-WmiObject | Get-Member

Special note, the pipeline symbol displays as ¦ in PowerShell, but as | in notepad.  See a whole page on Get-Member

b) Foreach-Object.  The purpose of this cmdlet is to loop through multiple instances, such as disk drives.  Foreach applies a block of script to each object in the pipeline.  For example;

$Nic= Get-WmiObject Win32_NetworkAdapterConfiguration
foreach ( $MacAdr in $Nic ) { "Mac Address = " + $MacAdr.MacAddress}

Note that the type of bracket is significant, () or {} each have a distinct role (condition) {script block}.  Also note the + which not only adds numbers, but also is the same symbol that concatenates text.

c) Where-Object (Often abbreviated to plain 'where') filters the input from the pipeline, allowing operation on only certain objects.  For example:

Get-Service | Where-Object {$_.status -eq "Stopped"}

d) New-Object.  Creates instances of .NET or COM objects.  New-Object is particularly useful for creating VBScript objects.  For example, network objects, Active Directory objects and also applications such as IE.

e) Select-Object.  Filters objects based on parameters set in the cmdlet command string

f) Group-Object.  An undervalued cmdlet.  Handy for collecting objects based on a common property value.

g) Sort-Object.  Sequences object based on a property value

Guy Recommends: Free WMI Monitor for PowerShellSolarwinds Free WMI Monitor for PowerShell

Windows Management Instrumentation (WMI) is one of the hidden treasures of Microsoft's operating systems.  Fortunately, SolarWinds have created a Free WMI Monitor so that you can discover these gems of performance information, and thus improve your PowerShell scripts.

Take the guess work out of which WMI counters to use when scripting the operating system, Active Directory, or Exchange Server. Give this WMI monitor a try - it's free.

Download your free copy of WMI Monitor

3) Items Built-In Windows PowerShell Cmdlets

a) Get-Childitem Retrieves the child items of the specified location(s), for example a list files in a folder

b) Get-Item Returns an object that represents an item in a namespace, for example Get-Item .\* lists files in the current directory

c) New-Item Creates a new item in a namespace, for example creates a sub-folder

d) Set-Item Sets the value of a pathname within a provider to the specified value

e) Remove-Item Deletes an item from a provider

f) Move-Item Transfers an item from one location to another, removing the original

g) Rename-Item Changes the name of an existing item

h) Copy-Item Copies an item from one location to another, leaving the original intact

i) Clear-Item Removes the content of an item

j) invoke-Item Invokes an executable or opens a file

k) Get-Acl Gets the access control list (ACL) associated with a file or item

l) Set-Acl Sets the security ACL for an item or items

4) Aliases Built-In PowerShell Cmdlets

Understanding Aliases is easy.  Just start with the built-in Aliases, for example gci (Get-Childitem).  Also ft (format table) for example, Get-Process * |ft name, handles, cpu -auto

a) Set-Alias Maps an alias to a command, for example where you wish to create your own alias.

b) Get-Alias Returns a list of all defined aliases

c) New-Alias Creates a new alias

d) Export-Alias Outputs the system alias table in CSV format

e) Import-Alias Updates the system alias table from a CSV file

f) PowerShell 3 has 11 more aliases

Guy Recommends:  A Free Trial of the Network Performance Monitor (NPM)Review of Orion NPM v11.5 v11.5

SolarWinds' Network Performance Monitor will help you discover what's happening on your network.  This utility will also guide you through troubleshooting; the dashboard will indicate whether the root cause is a broken link, faulty equipment or resource overload.

What I like best is the way NPM suggests solutions to network problems.  Its also has the ability to monitor the health of individual VMware virtual machines.  If you are interested in troubleshooting, and creating network maps, then I recommend that you try NPM now.

Download a free trial of Solarwinds' Network Performance Monitor

5) Drives Built-In Cmdlets

a) Get-PsDrive Returns a list of all drives registered with cmdlet providers

b) New-PsDrive Creates a new drive associated with a cmdlet provider

c) Get-PsProvider Returns a list of all registered cmdlet providers and the drives associated with each provider

d) Remove-Drive Removes a drive association from a cmdlet provider

6) List of Cmdlets Featuring Paths and Locations

a) Get-location Displays the current location

b) Set-Location Sets the current working location to a specified location. (It has the Alias CD)

c) Convert-Path Converts the path to the item given from an MSH path to a provider path

d) Parse-Path Given an MSH path(s), streams a string with the qualifier, parent path, or leaf item

e) Test-Path Returns true if the path exists, otherwise returns false

f) Resolve-Path Resolves the wildcards in a path

g) Push-Location Pushes a location to the stack

h) Pop-Pocation Changes the current working location to the location specified by the last entry pushed onto the stack

7) Contents Built-In PowerShell Cmdlets

a) Add-Content Appends content to a file or creates a file if one does not exist

b) Clear-Content Removes content from a file while leaving the file intact

c) Get-Content Returns the content of a file as a sequence of lines

d) Set-Content Replaces the content of a file with new content

Guy Recommends:  SolarWinds' Free Bulk Import ToolFree Download Solarwinds Bulk Import Tool

Import users from a spreadsheet.  Just provide a list of the users with their fields in the top row, and save as .csv file.  Then launch this FREE utility and match your fields with AD's attributes, click and import the users.

Optionally, you can provide the name of the OU where the new accounts will be born. Download your FREE bulk import tool.

If you need more comprehensive application analysis software,
Download a free trial of SAM (Server & Application Monitor)

More PowerShell Cmdlets Lists

8)  Access Operating System Components

a) Get-Process Returns a list of running system processes

b) Stop-Process Terminates a running process

c) Get-Service Returns a list of registered system services

d) Stop-Service Terminates a running system service

e) Start-Service Starts a stopped system service

f) Suspend-Service Pauses a running system service

g) Resume-Service Reactivates a paused system service

h) Restart-Service Stops then restarts a system service

i) Set-Service Configures the properties of a registered system service

j) New-Service Registers a new system service

k) Get-Eventlog Returns a list of event log entries from a specified event log

l) Get-WmiObject Returns data from WMI


9) Output Formatters Built-In Cmdlets

a) Out-File Sends output to a file

b) Out-Printer Sends output to a printer

c) Out-String Sends output to a string

d) Out-Null Drops all output

e) Out-Default Sends output to the host; not called from the command line

f) Out-Host Sends output to the host

g) Format-List Formats objects as a list of their properties displayed vertically

h) Format-Table Formats objects as a tabulated list (one line per object)

i) Format-Wide Formats objects as a tabulated list (several objects per line)

j) Import-Csv Generates a sequence of objects from a comma-separated variable file

k) Export-Csv Writes a sequence of objects to a file in comma-separated form

l) write-Host Writes an object to the hosting environment (usually the console)

m) Write-Progress Writes to the host's progress display channel

n) Write-Object Writes an object to the pipeline

o) Write-Debug Writes an object into the debug pipeline

p) Write-Verbose Writes an object to the host's verbose display channel; output may or may not be shown depending on the host settings

q) Write-Error Writes an object to the error pipeline

r) Read-Host Reads data from the hosting environment (usually the console)

10) Variables

a) Get-Variable Returns the value of a variable

b) New-Variable Creates a new variable with a specified name and value

c) Set-Variable Updates or creates a new variable with a specified name and value; useful at the end of a pipeline for storing objects into a variable for later use

d) Remove-Variable Removes a variable definition from the variable list

e) Clear-Variable Removes the value of a variable but leaves its definition in place (i.e., sets its value to null)

11) Security Built-In Cmdlets

a) Get-Pfxcertificate Returns an X509Certificate from a file

b) Get-Credential Generates a credential by asking an interactive user to provide a password

c) Get-Authenticodesignature Returns the Authenticode signature from a file

d) Set-Authenticodesignature Updates the Authenticode signature on a file

e) ConvertFrom-Securestring Creates a string that can be used to safely store and work with sensitive information (e.g., passwords)f

f) ConvertTo-Securestring Converts a secure string into an encrypted representation in a regular string

12) Miscellaneous PowerShell Built-In Cmdlets

a) Get-Date Returns the current date and time

b) Set-Date Updates the system date and time

c) Match-String Searches through a string or file(s) for a pattern

d) Measure-Object Calculates arithmetical statistics on specific properties of pipeline objects

e) New-Timespan Calculates the time difference between two specified DateTime objects

f) Start-Sleep Pauses processing for a specified number of seconds or milliseconds

13) Debugging

a) Set-PsDebug Enables/disables debugging and execution trace support

b) Trace-Command Enables tracing for a specified expression or command

Thanks to James J for correcting the above cmdlets.

Guy Recommends: The Free IP Address Tracker (IPAT) Free IP Tracker

Calculating IP Address ranges is a black art, which many network managers solve by creating custom Excel spreadsheets.  IPAT cracks this problem of allocating IP addresses in networks in two ways:

For Mr Organized there is a nifty subnet calculator, you enter the network address and the subnet mask, then IPAT works out the usable addresses and their ranges.  For Mr Lazy IPAT discovers and then displays the IP addresses of existing computers. 

Download the Free IP Address Tracker

Result of Get-Command

To get a complete list of all the PowerShell cmdlets, I went to the PS Prompt and typed:

Get-Command | fw -column 3

You can refine the example below, for instance, to list just aliases:
Get-Command -type alias | Format-Wide -column 6

Here are the results in three columns:

(fw -column 3 means format the output in three columns.)

Add-Content   Add-History      Add-Member
Add-PSSnapin Clear-Content   Clear-Item
Clear-Item      Property Clear-Variable         Compare-Object
ConvertFrom-SecureString      Convert-Path  ConvertTo-Html
ConvertTo-SecureString         Copy-Item      Copy-ItemProperty
Export-Alias   Export-Clixml      Export-Console
Export-Csv    ForEach-Object  Format-Custom
Format-List    Format-Table     Format-Wide
Get-Acl         Get-Alias           Get-AuthenticodeSignature
Get-ChildItem Get-Command    Get-Content
Get-Credential Get-Culture      Get-Date
Get-EventLog Get-ExecutionPolicy Get-Help
Get-History    Get-Host           Get-Item
Get-ItemProperty Get-Location Get-Member
Get-PfxCertificate Get-Process Get-PSDrive
Get-PSProvider Get-PSSnapin  Get-Service
Get-TraceSource Get-UICulture Get-Unique
Get-Variable   Get-WmiObject   Group-Object
Import-Alias   Import-Clixml      Import-Csv
Invoke-Expression  Invoke-History Invoke-Item
Join-Path      Measure-Command Measure-Object
Move-Item    Move-ItemProperty New-Alias
New-Item New-ItemProperty    New-Object
New-PSDrive New-Service       New-TimeSpan
New-Variable Out-Default       Out-File
Out-Host      Out-Null            Out-Printer
Out-String    Pop-Location      Push-Location
Read-Host    Remove-Item      Remove-ItemProperty
Remove-PSDrive Remove-PSSnapin Remove-Variable
Rename-Item Rename-ItemProperty Resolve-Path
Restart-Service Resume-Service Select-Object
Select-String Set-Acl             Set-Alias
Set-AuthenticodeSignature     Set-Content Set-Date
Set-ExecutionPolicy Set-Item  Set-ItemProperty
Set-Location Set-PSDebug      Set-Service
Set-TraceSource Set-Variable Sort-Object
Split-Path    Start-Service      Start-Sleep
Start-Transcript Stop-Process Stop-Service
Stop-Transcript Suspend-Service Tee-Object
Test-Path    Trace-Command  Update-FormatData
Update-TypeData Where-Object Write-Debug
Write-Error   Write-Host         Write-Output
Write-Progress Write-Verbose  Write-Warning

Summary of PowerShell's Built-In Cmdlets

PowerShell has a rich source of built-in Verb-Noun pairs.  While you probably only need about 20, it's worthwhile acquainting yourself with what commands are available.  Guy says waste no opportunity to increase your cmdlet repertoire.  To get your list of PowerShell cmdlets try: Get-Command *

If you like this page then please share it with your friends


See more Microsoft PowerShell tutorials

PowerShell Tutorials  • Methods  • Cmdlets  • PS Snapin  • Profile.ps1  • Exchange 2007

Command & Expression Mode  • PowerShell pipeline (|)  • PowerShell 'where'  • PowerShell 'Sort'

Windows PowerShell Modules  • Import-Module  • PowerShell Module Directory 

If you see an error of any kind, do let me know.  Please report any factual mistakes, grammatical errors or broken links.


Custom Search

Site Home

Guy Recommends: WMI Monitor for PowershellSolarwinds WMI Monitor

Windows Management Instrumentation (WMI) is most useful for PowerShell scripting.

SolarWinds have produced this Free WMI Monitor to take the guess work out of which WMI counters to use for applications like Microsoft Active Directory, SQL or Exchange Server.

Download your free copy of WMI Monitor

Author: Guy Thomas Copyright © 1999-2016 Computer Performance LTD All rights reserved.

Please report a broken link, or an error to: