官术网_书友最值得收藏!

  • Mastering PowerCLI
  • Sajal Debnath
  • 385字
  • 2021-07-09 21:47:49

PowerShell help files

Help files are the best way to get help (pun intended) in PowerShell. They provide the most intensive details about the cmdlet and includes overviews, detailed explanations, examples, and much more. As its name suggests, you get help by running the Get-Help cmdlet.

For people out there who love *NIX, Get-Help is the equivalent of man pages in the Linux or Unix environment. Actually, an alias of man à Get-Help exists in PowerShell (thanks to Brian Wuchner for pointing this out).

The first thing that you notice in PowerShell 3.0 onward is that all the help files are not included as part of the package itself. In order to use the full range and the updated help files, you need to get them from the Microsoft website. If you try to use Get-Help for a cmdlet for which the help files are not downloaded yet, you get a short help description and then the following notification:

PowerShell help files

So, you need to run Update-Help to update all the help files. What this command does is that it checks all the installed cmdlets and verify them against the online version. If it finds an updated version available online, then it downloads the updated version. So, when you run PS C:\ Update-Help, it updates the help files.

PowerShell help files

Remember that, since it will update the help files placed in the default system path, you need to have administrator rights to run this command, otherwise this command will run but will fail to put the files in the system directories. So, before you run this command, open and run the console as an administrator.

There are times when we do not have an Internet connection in a system, especially in data center environments. In such a situation, we can download the help files into a central repository and then later use that repository to update the help files. The first part can be done by running the Save-Help cmdlet:

PS C:\> Save-Help –DestinationPath <Path where to store the files>
PowerShell help files

Once the files are downloaded, you can use that location to update the help files:

PS C:\> Update-Help –SourcePath <Path where the help files are>
PowerShell help files

Tip

Note that Update-Help and Save-Help work only with XML-based help files. It is not available for comment-based help files. In the next section, we are going to talk more about comment-based help files.

主站蜘蛛池模板: 广德县| 资阳市| 遵义市| 广安市| 竹北市| 绩溪县| 广宁县| 绥德县| 高雄县| 家居| 沿河| 思茅市| 宣汉县| 蕲春县| 建德市| 南开区| 定兴县| 石柱| 宁安市| 比如县| 德化县| 吉木乃县| 望谟县| 晋城| 浦县| 榕江县| 双柏县| 基隆市| 新野县| 夏津县| 鱼台县| 新巴尔虎右旗| 合水县| 旬阳县| 启东市| 曲沃县| 建湖县| 伊吾县| 井冈山市| 太仆寺旗| 潼关县|