I wouldn't add all of that validation inside of the script itself. The script is meant to apply settings. I would definitely pull all of that out into a set of Pester tests. Putting some validation checks in your scripts is great but it sounds like you might be overdoing it. Adding more code adds more complexity and it's important to keep scripts as simple as possible. If those tests are separated out into a Pester test you have the opportunity to do unit testing as well as some of the integration testing you're talking about.