From the course: Learning PowerShell Core

Getting help - PowerShell Tutorial

From the course: Learning PowerShell Core

Start my 1-month free trial

Getting help

- [Narrator] Let's now see how we can use the PowerShell help system. So the help system is extremely useful in PowerShell, especially when you get started. You'll see that it's much more powerful than a typical Linux man help system or some of the old documentation that you used to do. So to reference the help system, we have a command called get dash help, the way to find help for all of the commands inside of PowerShell. So let's say that I want to find help for the get content command. I can use the name parameter, type in get content, and notice I am hitting tab. When I hit tab, tab completion is almost muscle memory for me by now, where you can just type in get dash, and just hit tab just about anywhere in PowerShell and it will magically know what you're talking about. All right, so let's say that I want to find the help content for get content. When I enter, notice that we have a nice view of the syntax, all the different parameters that we can use with get content. We have all the aliases that it has, and some kind of remarks. And we, notice that in the remarks it says "Get help cannot find the help files for this computer." I'll show you how to fix that here in just a minute. Let's say that, with get content, you want to know what the parameters are, so reading up around the top, you see that tail parameter. And you wonder, well what does that tail parameter actually do? To find that out we can use get help, specify the name of the command, get content. And then provide the parameter parameter to get help. And then we can type in tail. That provides some information, for tail it was an integer. The tail value needs to be in integers is not required, and some other information that we're not going to go over right now. So it's not a lot of great information, we want to know what that actually does. So what we can do is, we can pull directly from online, from the Microsoft repository. I can use the dash online parameter, hit enter, and then now you can see that the parameter set could not be resolved. This is an error message that comes up whenever you provide parameters that are not in the same set. So you cannot use some parameters with others. So let's see that we can do this online without the parameter parameter. All right, yes that worked. All right, so now with the online, it brings up the browser here, and you can see online, you can read all this same information, this is the same information that you can get from the PowerShell console directly in the browser. Now let's say that you want to find that information without actually having to go to the browser. We can do it, get help has various levels. So the first one we just looked at, which is the base level. The next is detail. Detail provides more information, and we can go up another level, and we can actually do full to find even more information. And then it brings back all of the other information that we're looking for. However, that remarks is down there. Get help cannot find the help files, it is only displaying partial help. For this we need to use update help. When I run update help, it's going to go out to Microsoft, find all of the latest and greatest help content, and download it locally to my machine. Now I don't have to use the online parameter to go out and open up a browser to see the most relevant help information. I can pull all that information down with update help. And now all of that content will be available to me within PowerShell itself. Some errors were returned, however you'll find that some modules, even the developed modules, are not actually 100% working. There's a few bugs here and there, but you will expect some errors. However, now when we go over to get help and we use the detail parameter for get content, now you can see lots of other information comes back. Especially, my favorite part, which is the examples. We can see examples for how this command is used. So one of the first things you should do whenever you bring up a new PowerShell instance, is always run update help. This will grab all of the latest and greatest help content for you.

Contents