RUVIDEO
Поделитесь видео 🙏

PowerShell 03: Help system part 1

One of PowerShell's shining features is its helping system. It could be evaluated as the most import resource in PowerShell. If you don't have an internet connection, you can still use offline help system with abundant information. Even if you have an internet connection, you will still find it handy to search for the commands you want, and get your work done. You will see how this can be accomplished in the following demos.

Because of the importance of PowerShell help system, after we have PowerShell installed and updated, I feel the next tutorial lesson should be dedicated to learning how to use the help system.

The first thing we should do is to run PowerShell as administrator. So you can update help system. If you see the error messages like "Updatable Help System Requires Elevation", it basically means that PowerShell is not running as administrator.

(demo starts)

Go to bottom left corner and type "powershell". Hold shift key and right-click the best match result "Windows PowerShell". Select "Run as administrator" option in pop-up dialog.

To verify if PowerShell is running as administrator, check the title of PowerShell window. It should start with "Administrator".

(demo ends)

PowerShell does not come with help system pre-installed. The reason could be that the help documents are still under modification and update even after the PowerShell has been released to the public. It makes sense to update help system when you start using it for the most up-to-date version. The command to update help system is simple, which is "update-help". But as it will be clear in the demo, you may have to add some switches for the update process to complete because the help documents for some modules may fail and prevent others finishing update.

(demo starts)

Let's first try "update-help" cmdlet without any switch. It starts updating for various modules. Then it failed to update help for the modules such as Defender, ODataUtils, Validation with error messages like:
- The server on which help content is stored might not be available
- try the command again

In another section, it failed to update help for the module WindowsUpdateProvider and asked to check your network connection.

Now we will use workaround to update help system with switch "-Force". Notice that you can use Tab for auto-completion. For the next switch, we can use ctrl + space key for help context, type -ErrorAction, then "SilentlyContinue".

Now let the update finish. It could take several minutes to update the help system for all the modules.

With switch "-Force", the update will forcefully complete the script even if error occurs in between. Error action switch with SilentlyContinue parameter will force the process silently skip the failures and move on to the next module. Practically, I never got into troubleshoot by skipping the failures during update. The help works just fine even I know some modules' help files may not be update-to-date.

Now update is completed. We can move on to use it.

(demo ends)

To get the help for a command, for example "get-host" that we used in the last tutorial to check PowerShell version, we can use this syntax: get-help get-host.

You can also use alias "help" or "man" in place of "get-help". "Help" is a DOS command, and "man" is a Linux or Unix command.

As update-help cmdlet, get-help also has some switches we can use to get different behaviors. We will see it in the following demo.

(demo starts)

(demo ends)

Another useful cmdlet I also include it as part of the help system is: get-member.

Since the output from cmdlets is object, get-member can help you to quickly find out which properties and methods are available.

If you use pipe symbol, or a vertical bar, after a cmdlet, like get-host, followed by get-member. The members, properties and methods of get-host will be displayed.

You can also use alias "gm" in place of get-member to type less.

(demo starts)

(demo ends)

Here is a quick summary of what we have learned in the first part of this tutorial on PowerShell help system:
- Update help system with update-help and -Force switch, and -ErrorAction switch with parameter SilentlyContinue.
- Get help on a specific cmdlet "get-host" with -ShowWindow switch.
- Retrieve cmdlet "get-host" member methods and properties by piping the output to get-member

Please move on to part two to learn more on the help system.

Thanks for watching!

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «PowerShell 03: Help system part 1», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.