- March 27, 2016 at 7:26 am #37000
I'm fairly savvy with scripting and have been using the command prompt for a long time. Recently I came across a task that was well-suited for PowerShell, so now I want to "dive in". I've got a pretty good handle on the basics, but when it comes to actually using a new tool, I want to use it correctly. So, when it comes to any specific command prompt command, how do I locate the corresponding PowerShell cmdlet? Please don't just answer my "example" question ("teach me to fish"), but if, for example, I want to replace "ipconfig", "tracert", "ping", etc, with their PowerShell equivalents, how do I find them? I don't really want to be Googling every time (ideally). I know the help can be searched in a lot of ways. I'm hoping there's a way to list the aliases (or whatever).
Thanks in advance.
MarkMarch 27, 2016 at 7:37 am #37001
First, understand that there isn't necessarily a 1:1 correspondence. That's key, because it means you'll need to focus more on the task being performed, or the info being retrieved. Think about those as nouns, and then – as cleverly described in "learn PowerShell in a month of lunches" – use Get-Command.
Get-Command -Noun *address*
As an example, would show me commands that work with addresses, such as, perhaps, an IP Address or a MAC address.
This is different from searching help, and more inclusive. However, don't assume there's an equivalent to ipconfig or any other external application, because for the most part, there isn't. Unlike Dir or Cd or Del, which are indeed commands, Ipconfig and Netstat and so on – even Ping – aren't commands. They're complete applications (EXE files) that can be run within the Cmd shell or within PowerShell equally well.March 27, 2016 at 5:22 pm #37010
Thanks Don, that helps! Much appreciated.
You must be logged in to reply to this topic.