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. This page deals with the first meaning and
includes a review of PowerShell's built-In cmdlets. PowerShell
Cmdlets Lists of the 13 Sections- System Built-In Cmdlets
- Objects Built-In Cmdlets
- Items Built-In Cmdlets
- Aliases Built-In PowerShell Cmdlets
- Drives Built-In Cmdlets
- Paths and locations
- Contents Built-In PowerShell Cmdlets
- Access Operating System Components
- Output Formatters Built-In Cmdlets
- Variables
- Security Built-In Cmdlets
- Miscellaneous PowerShell Built-In Cmdlets
- Debugging
♣
PowerShell Build-In Cmdlet Categories
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.
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 a) Get-Member. This is by far the most
important cmdlet. 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 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
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
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
SolarWinds Firewall Browser

Here is an utility where you can review firewall settings such as
access control lists (ACL), or troubleshoot problems with network
address translation (NAT).
Other reasons to download this SolarWinds Firewall Browser include
managing requests to change your firewall settings, testing firewall
rules before you go live, and querying settings with the browser's
powerful search options.
Guy recommends that you download a copy of
the SolarWinds
free Firewall Browser.
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
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
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 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.
More PowerShell Cmdlets Lists
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
|