Book Image

Learning PowerShell DSC

By : James Pogran
Book Image

Learning PowerShell DSC

By: James Pogran

Overview of this book

Table of Contents (14 chapters)
Learning PowerShell DSC
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

What makes a good DSC Resource


At this point, we've covered the structure, syntax, and how to create DSC Resources for both PowerShell v4 and v5. Even with this knowledge, it is good to step back and consider what makes up a good DSC Resource. Remember when we were covering DSC configuration scripts in the previous chapter and we spent some time on best practices for creating them? The same approach applies here.

Idempotent

It is up to you to uphold the tenants of idempotency that we have been learning over the course of this book in each DSC Resource you author. The DSC Resource is the last stop in the line of executions that determines whether the current state of the target node is the desired state we described in the DSC configuration script. You must write the code that tests and sets this state in a way that will only change the state of the target node once, the time when the system is not in the desired state.

Significant care must be taken when accomplishing this. You must not change...