liveBook · Manning

Reusable building block

As explained in Practical Automation with PowerShell: Effective scripting from the console to the cloud

A reusable building block is a modular automation component that can be incorporated into multiple processes.

A reusable building block is a modular automation component designed for incorporation into multiple processes. It turns a one-off script into a repeatable asset that supports phased automation and reduces duplicated effort. section 2.0 section 1.2

Design the automation around four questions:

  • Goal: what must the automation accomplish? section 1.2
  • Trigger: what initiates the actions? section 1.2
  • Actions: which steps produce the intended result? section 1.2
  • Maintainability: what will it take to maintain the overall automation and each building block? section 1.2

Log cleanup as a reusable component

A web server fills its drives with logs that must remain available for security audits. A phased automation can find logs older than 30 days, compress them, and move them to long-term storage. Turning that cleanup script into a reusable building block makes the capability available to other automations; PowerShell functions can then be stored in a module for reuse. section 2.0 section 1.2

How Practical Automation with PowerShell: Effective scripting from the console to the cloud covers it

How deep it goes
Explains the design factors and reuse strategy, then stops short of supplying the component's implementation.
Examples
Uses web-server log archiving and barcode-versus-RFID processing costs as practical automation examples.
What it assumes
Assumes familiarity with PowerShell and phased automation while applying those ideas to modular reuse.
What you can do after
Build it from scratch by transforming a simple PowerShell script into a reusable function and storing it in a module.
How it connects
Connects phased automation with functions, modules, triggers, actions, goals, and maintainability.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Practical Automation with PowerShell: Effective scripting from the console to the cloud. The section links point to the parts of the book it draws on.