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

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.

主站蜘蛛池模板: 海阳市| 泗洪县| 桓台县| 句容市| 扎囊县| 新竹市| 封丘县| 梨树县| 屏东市| 郸城县| 浮山县| 永川市| 册亨县| 阳原县| 郴州市| 和田县| 镇平县| 松潘县| 徐水县| 舟山市| 城口县| 乐都县| 牡丹江市| 横山县| 民和| 金山区| 沁阳市| 公主岭市| 南靖县| 竹溪县| 瑞丽市| 玛曲县| 高要市| 囊谦县| 榆中县| 登封市| 桐城市| 南郑县| 鱼台县| 建湖县| 徐汇区|