Okay, are you ready for the shocking revelation?
help *
Yup, that is it. Just plain good old get-help module shortened to just help *.
I think that no matter how skilled you are with any kind of code you should always know how to get more info in case you get stuck or just don't know how a command might react.
How to use?
The first thing I always do, before I start any major project, is update to my Powershell get-help module.
To do this type update-help. Be prepared to wait a couple of minutes though, as PS needs to contact Microsoft servers for the latest information. Don't worry if you get errors, it just means that the get-help module is up to date.
When you are done updating your help module we can finally begin exploiting it's contents.
To do this type update-help. Be prepared to wait a couple of minutes though, as PS needs to contact Microsoft servers for the latest information. Don't worry if you get errors, it just means that the get-help module is up to date.
When you are done updating your help module we can finally begin exploiting it's contents.
Usually when I start doing something I try to find out all the information possible of the modules I am going to use. After all, you need to know what you can do with your tools, right?
So basically it all comes down to choosing the right search function/word.
I will for the sake of simplicity split this post in two sections; Powershell and Google.
I will for the sake of simplicity split this post in two sections; Powershell and Google.
Powershell
Get-help object works the same as other PS-modules. First comes the module and then you give it the search parameter(s). ie. get-help out-file.
Get-help however only searches for the module name. Using help * will search not only the module names, but it also includes the descriptions and instructions of the module info texts in to the search and by that way makes the search function even more useful.
Okay, so now that we have established how to do a search, we need to learn how to use the function to gain more information.
First, do a search:
help* out-file
help* out-file
Good. We will get the following print out.
Now that we have the information out we can take a look at the Remarks section. As you can see you have more options. You can choose which kind of extra information you can request from PS.
I personally love to use -examples addition.
ie. get-help out-file -examples
Another good one is:
get-help out-file -full
The -examples addition gives you a short list of example strings of how to use out-file module.
Get-help out-file -full, prints out all the extensions in one session for easier access.
I will post a small portion below of the result of get-help out-file -examples
Powershell doesn't have all the answers. No matter how great the get-help function is. Therefore it is of utmost importance that you know how to use Google's search functions.
Now I know you might be thinking "What is wrong with just typing the wanted command down?".
Now I know you might be thinking "What is wrong with just typing the wanted command down?".
Well, if you just decide to do a search for "how to use (module) in powershell" you might end up with some un-relevant search results´and we all know going through all that stuff is just wasting your time.
Try instead ie. "Powershell: Out-file how to out html?" and I guarantee you will get more accurate hits.
Try instead ie. "Powershell: Out-file how to out html?" and I guarantee you will get more accurate hits.
To wrap this up here is a small tl;dr for you lazies:
That is all for now folks.
- get-help module can be used with help *(search word)
- Adding a remark-extension at the end of get-help command will give you extra information.
For example: get-help out-file -examples will give you some examples of how to use the out-file module. - Always use powershell: (search word) or cmdlet: (search word) for you'r Google searches to get better hits with the search engine.
That is all for now folks.
Next time: We will tamper with time travel!
Ei kommentteja:
Lähetä kommentti