Iron Scripter prelude

Another Validation Solution for Prequel Challenge 4

The other day the Chairman shared a possible solution for prequel challenge #4. In his enthusiasm for PowerShell and automation, he jumped the gun on the next challenge which was to have you create a validation test.  But that’s ok. Because this provides an opportunity to share a variation on the validation tests.

In the previous solution, the Pester test ran in the remote machine, technically a container in the Chairman’s solution. That meant you needed to make sure Pester was up to date. But the Pester test could also be run from an administrator’s desktop which presumably is already running the latest version of Pester. In this example, the test file is run locally but all the assertions are executed remotely via a PowerShell session.

This test assumes a Hyper-V virtual machine as the remoting session is created via PowerShell Direct.

Running the Pester tests

Not that this type of test isn’t mocking or pretending to do anything. It is running the actual commands to verify the server configuration. This script too could be run with other Invoke-Pester parameters to automate further based on test results.

Remember, that if you encounter a road-block in creating a Pester test, you might first check the Pester wiki. Or get some friendly assistance in the forums at PowerShell.org.