6.2 Table of Basic PowerShell Commands - Scripting Blog
6.2 Table of Basic PowerShell Commands - Scripting Blog
Scripting
Developer
Login
Technology
.NET
Platform Development
Dr Scripto
Data Development
Microsoft
Summary: Ed Wilson, Microsoft Scripting Guy, provides a table of basic Windows PowerShell commands.
Scripting Guy, Ed Wilson, is here. Some questions are simply confusing, and other
questions can be misleading, or even wrong. What do I mean? Well, I recently received a
question from a person who wanted to know how to “use WMI to do xyz…” Such a
question betrays an assumption. For example, it may be that the best way to accomplish
a specific task is to not use WMI, but to use “native Windows PowerShell” functionality.
Certainly, for example, I would use Get-Process to retrieve process information on my
local computer—unless there was something that WMI would do differently or provide
an alternate capability. At times, I will clarify a person’s question, intention, and goals. At
other times, I will directly answer the question, and then suggest a better way to
accomplish what I think the goal is. Other times, I will answer what I think their question
is and be done with it. When a person asks about Windows PowerShell commands, are
they really talking about native Windows PowerShell commands (such as the language
statements For, Foreach, or Switch)? Or are they talking about Windows PowerShell
cmdlets? Or are they talking about a string of Windows PowerShell cmdlets that taken
together become a unique Windows PowerShell command? When I am writing my
Windows PowerShell books (such as my book, Windows PowerShell Best Practices), I
tend to call a collection of Windows PowerShell cmdlets that are strung together to
accomplish a specific task in a Windows PowerShell command. But at other times, I
actually vary my answer according to what I perceive to be the level of expertise of the
questioner. For example, often people will come to me after I have spoken at a
conference (such as the IT Pro Camp in Jacksonville where Teresa and I will be speaking
this Saturday). If they ask something like, “I know nothing about Windows PowerShell.
Can you tell me the most basic Windows PowerShell commands?” I will not necessarily
take the time to tell them that they are probably asking about cmdlets, not commands.
With this in mind, the following chart lists Windows PowerShell command aliases, the
Windows PowerShell cmdlet name, and a description of what the command actually
does.
gbp Get-PSBreakpoint Gets the breakpoints that are set in the
current session.
gc Get-Content Gets the contents of a file.
h Get-History Gets a list of the commands entered
during the current session.
history Get-History Gets a list of the commands entered
during the current session.
icm Invoke-Command Runs commands on local and remote
computers.
mi Move-Item Moves an item from one location to
another.
mount New-PSDrive Creates temporary and persistent mapped
network drives.
move Move-Item Moves an item from one location to
another.
sajb Start-Job Starts a Windows PowerShell background
job.
sal Set-Alias Creates or changes an alias (alternate
name) for a cmdlet or other command
element in the current Windows
P Sh ll i