Call Us: US - +1 845 478 5244 | UK - +44 20 7193 7850 | AUS - +61 2 8005 4826

Basic PowerShell Commands

Microsoft 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 ForForeach, 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.