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

Chapter 2. Script Structure, Comment Blocks, and Script Logging

The Windows server scanning script requires three core components to make the script suitable for enterprise environments. These components include developing a strict scripting structure, creating the comment block, and developing a flexible logging solution. Strict scripting structures ensure that all your scripts are created in the same order. This means that each section of the code is defined in the same place in all your scripts. A uniform structure helps others understand your code quickly and enables them to follow a standardized format for changes.

You will also learn how to create a comment block at the beginning of the script. The comment block ensures that you fully document the purpose, the requirements, the bug fixes, and change history for the script. It also provides details on how to execute the script leveraging command line parameters.

The final core component discussed in this chapter is logging mechanisms. Logging mechanisms provide the ability to record information about what is being performed during the execution of the script. This information is typically written to log files, event logs, and data collection files.

In this chapter, you will:

  • Learn the overall structure of a PowerShell Script
  • Create a comment block to describe the script's function
  • Develop a logging platform for your scripts

Note

The examples in this chapter build upon each other. You will need to execute the script sequentially to have the final script in this chapter work properly.

主站蜘蛛池模板: 康马县| 湖州市| 遂昌县| 泽库县| 云南省| 彩票| 尼勒克县| 澄城县| 微山县| 桃园县| 略阳县| 青川县| 黎城县| 万山特区| 安图县| 册亨县| 三明市| 厦门市| 从江县| 民和| 永安市| 惠来县| 祥云县| 博客| 铁岭县| 舟山市| 玉田县| 平顺县| 五原县| 普陀区| 承德县| 吉林省| 乌海市| 阿城市| 尚义县| 车致| 乐东| 共和县| 香格里拉县| 娱乐| 乐业县|