Summary
In this chapter, you learned different scripting techniques that can optimize execution speed. You first learned how to measure script execution duration by leveraging the measure-command
cmdlet. You then compared the time difference between writing data to the screen and keeping operations in memory. You then learned a technique to turn on and off writing data on the screen to optimize script execution during runtime. You proceeded to evaluate the write-progress
cmdlet and how it affects performance. You completed the chapter by evaluating the performance differences between if
statements and switch
statements.
In the next chapter, you will learn how to leverage regular expressions for string matching, to significantly improve scripting performance.