Best practices for software automation

Automation through PowerShell can be a very powerful tool when it's done right. There are few things that you can do, however, they will reduce the complexity of large automation scripts and increase reliability of execution. This section explores two things you can do that will greatly improve your success with automation whenusing PowerShell.

The first consideration is breaking apart scripts that contain 2000+ lines into smaller scripts. This allows you to better troubleshoot what items are failing and also makes the scripts more reusable for different tasks in your environment. For most purposes, you can break your large scripts into multiple scripts by what you're trying to accomplish. If you are installing ...

Get Mastering Windows PowerShell Scripting now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.