The entire page has no explanation for item’s enclosed in a set of ‘{curley braces}’ or, item’s between two pipes ‘|’. Current example:
“[-Category {Alias | Cmdlet | Provider| General | FAQ | Glossary | HelpFile | ScriptCommand | Function | Filter | ExternalScript | All | DefaultHelp | Workflow | DscResource | Class | Configuration}]”.
Without the aforementioned explanation’s for ‘{}’ and ‘|’, I’m assuming “Get-Help -Category Alias”, or any ‘one’ of the other item’s between two pipes, is a valid Syntax. I have played around with “Get-Help -Category ???”, and found not all of these item’s are valid categories, don’t work with “-Category”, and/or otherwise result in nothing being returned. The following example returns a Powershell prompt – “Get-Help -Category Workflow”.
I further assume all item’s between { and } can be used one at a time. Pipes ‘|’ are to mean ‘OR’, as in ‘this | that’. Please confirm, explain or otherwise point the original poster to an article that will provide further understanding.
I am a slow learner and need to teach myself at a pace I’m able keep-up with.
Firstly, when posting code or output in the forum, please can you use the preformatted text </> button. It really helps us with readability, and copying and pasting your code (we don’t have to faff about replacing curly quote marks to get things working). If you can’t see the </> in your toolbar, you will find it under the gear icon.
The square brackets [] indicate the parameter is optional.
The values in the curly brackets {} are the permitted values for the Category parameter.
The pipe symbol | is just a separator. If you look at the parameter help for Category you can see it accepts an array of strings so multiple categories can be specified.
PS E:\Temp> Get-Help Get-Help -Parameter Category
-Category <System.String[]>
Displays help only for items in the specified category and their aliases. Conceptual articles are in the
HelpFile category.
The acceptable values for this parameter are as follows:
As noted in the article you linked, the help system does not just display information about how to use commands, it helps you find commands by searching for commands that match your input and, if no commands match your input, by performing a full-text search on all help files on your system.
The Category parameter helps you filter the search results. Run the following commands and compare the output.
@matt-bloomfield hi, thank you for the prompt response.
Does the above apply to Copy-N-Paste of output from Get-Help or, only commands and scripts?
This is where I’m confused, the following works Get-Help -Category alias; the following does not work Get-Help -Category filter. I can see that both Alias and Filter are permitted values within curly braces, within the original post; shown again below,
[-Category {Alias | Cmdlet | Provider | General | FAQ | Glossary | HelpFile | ScriptCommand | Function | Filter | ExternalScript | All | DefaultHelp | Workflow | DscResource | Class | Configuration}]
Am I correct that when using -Category <string[]>, that string[]> is a place holder for any of the aforementioned permitted values separated by the pipes within the curly braces? If so, why will only one of the above previous examples work and not the other?
There is no doubt I’m doing something incorrectly, I’m trying to figure out, exactly what I’m not understanding.
The other part(s) of your reply, at this point, adds another layer of confusion. I need to first understand what I’m missing above.
Yes, please. Any console input/output. Anything copied from VSCode or your favourite editor. Any example data: CSV, JSON etc.
Define ‘does not work’. Do you get an error?
More likely you just don’t get any output, and that’s because you don’t have any help matching the ‘Filter’ category. So it works, there just aren’t any results to return.
If you run this command, you’ll find all the categories that should return results:
@matt-bloomfield … above (no results\no error), is the exact case after entering Get-Help -Category filter. For me, referring to the following excerpt:
[-Category {Alias | Cmdlet | Provider| General | FAQ | Glossary | HelpFile | ScriptCommand | Function | Filter | ExternalScript | All | DefaultHelp | Workflow | DscResource | Class | Configuration}]
… the confusion begins with --why is the help-system including supposedly valid “permitted values”, that are not used? A perfect example is Get-Help -Category filter; why is ‘Filter’ even listed, if it’s not being used? I’m stuck on this while I continue to wonder, how many more encounters like this will I experience with other cmd-lets?
My Powershell usage will be very limited, to only by-passing the GUI, by using the command-line and filtering through results >> a txt and/or csv. I believe time is better served learning the help-system, compared to, the time it takes to copy and decipher someone else’s script, then adapt it for/to my application.Please correct where needed,
Above is a perfect example for wanting to first understand the help-system. While your example seems pretty straight forward, I still do not have a firm grasp on the terms and glossary specific to PS. I.E. I’m not sure what is or, is not considered an object. Last I checked, you used -Category as a <String[]> value to -Category. In your last example (above) it appears Category is now an Object. Or am I again confused, Is your last usage or ‘Category’ the same as the previous usage shown as ‘-Category’?
I’m not asking you to explain that now, I’ll get the feel of it in time; was just pointing out how I am getting confused.
It is being used. You’re saying to the help system “hey, get me all the help information that matches the category ‘filter’”. By returning no output, the help system is telling you that there is no help that matches that category.
With respect though, you’re overthinking it. I’ve been doing PowerShell 12+ years and I’ve never, in all that time, searched or filtered help by category. You don’t need to dive very deep into the help system to use it effectively and the article you linked over complicates it for beginners.
I would suggest getting Learn PowerShell in a Month of Lunches which will take you through the fundamentals at a level that’s designed to get you up and running quickly, and make you immediately effective rather than getting bogged down in the whys and wherefores of the language.
@matt-bloomfield Thank you for your continued support and feedback; It is helping. The example usage Get-Help -Category filter, was an effort at getting my feet wet with typing\entering PS syntax and reviewing both, the resulting output and its formatting. I got stuck early on at this point because, I didn’t want to by-pass ‘this’ concern, get too far into learning the help-system, bump into a similar issue, then find out ‘this’ very intstance was\is related. Now I would need to bouce-back to figure out what I missed or didn’t correctly understand.
As far as hard copy publication’s, I’ve found that most of the content is already online, free of extra fee’s and royalties, albeit scattered, literally in every possible corner of the Internet. This is my reason for starting with Learn.Microsoft. That has been my experience while reading O’reilly in regard to Unix variant’s. I like O’reilly, but the content is somewhat ‘free’ with the exception of the obvious existing Inet and PC.
To bring this to a close, while you recall your first year learning Powershell, not in a classroom, along with your existing (at that time) experience, --comparing your initial book suggestion, to the O’reilly Powershell offering’s, which do you feel would offer more of a solid learning and product support experience? Product support meaning, typ-o’s and update’s.
I can’t compare the content with O’Reilly’s offerings because I haven’t used an O’Reilly book for many years. Nothing against O’Reilly, they’ve just not published any of the books I’ve bought.
I will say that I’ve always found the Manning books to be excellent, in particular the Month of Lunches series. I own five of them, plus the more recent Practical Automation with PowerShell (not a Month of Lunches book but follows the same format).
Manning provide forums, publish errata, have the code from the books on Github, and if you buy the physical book, you get the e-version included.
I second this recommendation. ‘Learn PowerShell in a Month of Lunches’ is the book I recommend to everyone wanting to learn PowerShell. Yes, all of the information is out there online, but it is scattered and not organized. The book gives a step-by-step introduction to the basics of PowerShell in easily digestible chunks that really gives a good solid foundation for using the language.
Plus, even if you can get the same information for free, it’s always good to support authors who write excellent and well-organized learning material by purchasing their books.
Besides the fact that it’s sad that you can’t use 7 … I would go for third edition. Fourth edition goes into running on Linux/MacOS which you can’t do with 5.1.
@darwin-reiswig – that is very good information; MacOS. Its not that I [can’t] install or use 7, I’m thinking, --being an extreme novice, I wouldn’t have need for anything beyond basic PS usage. However, I was just gifted an ancient Apple Tower, not sure what OS version is installed; not yet powered on. That tower is slated to be a small storage\server and would be the only reason to install and use PS Ver: 7.
Then again, I’ll do a price comparison, if there is only a difference of lunch money, between the two edition’s, I may as well purchase the fourth Edition.
According to the listing you get an e-copy of the third edition when you buy the fourth edition so the best of both worlds if you don’t mind reading off a screen.
If it’s not a requirement to use 5.1, I definitely recommend going to 7. Even though most of PowerShell is the same, using 7 will position you for what’s current and for cross-platform.